␡
- What is .NET Metadata?
- Attributes Everywhere You Turn
- System.Reflection.Attribute
- Your First Attribute
- Interrogating Your Metadata
- Wrapping It Up
- References
Like this article? We recommend
System.Reflection.Attribute
When you see [Serializable]and [NonSerialized] attributes in your code, the compiler decorates the class' metadata with the SerializableAttribute and NonSerializedAttribute classes. How does it know that those classes are attributes? It knows because each of these classes derives from the System.Reflection.Attribute class. Every attribute you use must derive from this class. It is the magic that tells the compiler that it is an attribute.