
Standard .NET attributes serve functionality similar to C++ preprocessor or pragma commands. They can be used to provide to the compiler additional information pertaining to some item in a program. They can be used to simplify certain programming tasks, e.g. setting security requirements declaratively (CodeAccessSecurityAttribute), controlling the physical layout of the data fields of a class or structure (StructLayoutAttribute), setting COM GUIDs to .NET classes (GuidAttribute), etc. They can even be used to deprecate items (ObsoleteAttribute). Attributes are no doubt a very useful .NET feature.
|