In asp.net what is the difference between ValidationProperty and ValidationPropertyAttribute metadata attribute?
Simple Question, but I can't seem to find th开发者_JAVA百科e answer.
What is the difference between the ValidationProperty
and ValidationPropertyAttribute
metadata attributes?
Nothing, attributes can be used with their full name or without the Attibute
suffix. The comiler will automatically add Attribute
if it can't find an attribute with the short name.
Note By convention, all attribute names end with the word "Attribute" to distinguish them from other items in the .NET Framework. However, you do not need to specify the attribute suffix when using attributes in code. For example, you can specify HelpAttribute as follows:
[Help("http://localhost/MyClassInfo")] // [Help] == [HelpAttribute]
From http://msdn.microsoft.com/en-us/library/aa288454(v=vs.71).aspx#vcwlkattributestutorialanchor2
There is no difference. You can use both [ValidationProperty]
and [ValidationPropertyAttribute]
. Ending 'Attribute' is optional. The same is for all other system attributes.
精彩评论