Tuesday, June 12, 2012

What is a C# Attribute?


What is a C# Attribute? 

Real short answer: It is a way of tacking declarative information into C# code (as opposed to something that actually generates code that does something like assigning a variable). You can use reflection to look up attributes. You can use system defined declarations or your own. Syntax uses square brackets such as [System.Attribute]

Common attributes:

  1. [System.Serializable]
    [Obsolete("Don't use Old method, use New method", true)]
    continues at main article: What is a C# Attribute? 
    
    
    
    

No comments: