ATTRIBUTES IN C#
• Attributes provide a powerful method of associating declarative information with C# code (types, methods, properties etc.)
• Once associated with a program entity, the attribute can be queried at run time using a technique called Reflection
• Attributes exist in two forms
1. Attributes that are defined in the CLR’s base class library
2. Custom attributes that are user created to add extra information to the code
• Attributes have following properties:
o Attributes add metadata to the program
o Metadata is information embedded in the program such as compiler instructions or descriptions of data
o A program can examine its own metadata using Reflection
o Attributes are commonly used when interacting with COM
No comments:
Post a Comment