How is it possible that C# attributes have “Attribute” in their name (e.g. DataMemberAttribute) but are initialized without this suffix? e.g.:
[DataMember]
private int i;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
According to the C# Language Specification,
This is a shortcut provided by the C# compiler and by no means a CLR feature. Another example of special treatment of attributes by the compiler is an ObsoleteAttribute attribute: this one forces a compiler to issue a warning/error, but it has no special meaning for the CLR.
As for how attributes are resolved, see the link above. To sum it up:
A “verbatim identifier” is an identifier with an
@prefix.Continuing with MSDN: