我有一个自定义属性类,我定义为:
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] public sealed class MyCustomAttribute : System.Attribute { ... }
从微软网站:
By convention,the name of the
attribute class ends with the word
Attribute. While not required,this
convention is recommended for
readability. When the attribute is
applied,the inclusion of the word
Attribute is optional.
所以,属性可以由任一个使用
[MyCustom()]
要么
[MyCustomAttribute()]
我的问题给大家,如果有人使用名称的缩写版本和全名遇到任何问题吗?我正在运行4.0框架.
谢谢!