In asp.net, what is the difference between the ValidationProperty attribute and the ValidationPropertyAttribute metadata?

A simple question, but I can not find the answer.

What is the difference between ValidationProperty and ValidationPropertyAttribute metadata attributes?

+4
source share
2 answers

Nothing, attributes can be used with their full name or without the Attibute suffix. The compiler will automatically add an Attribute if it cannot find the attribute with a short name.

Note. By convention, all attribute names end with the word β€œAttribute” to distinguish them from other elements in the .NET Framework. However, when using attributes in your code, you do not need to specify an attribute suffix. 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

+6
source

There is no difference. You can use both [ValidationProperty] and [ValidationPropertyAttribute] . The ending "Attribute" is optional. The same applies to all other system attributes.

+1
source

All Articles