Chapter 12. Reflection and Attributes

C# programs are self-describing. When you compile a C# program, part of the EXE or DLL you generate contains metadata (extra information) that tells you the classes that your EXE or DLL contains. It also tells you about the members of each class: the fields, properties, methods, delegates, events, etc. This information is always available to your program and other programs, and can be reached through a mechanism known as reflection. In addition to being able to read information about a particular class and its members, it’s also possible to extend this metadata with attributes. Attributes are classes that extend the metadata about a certain class or member in the class. You can create your own attributes easily, ...

Get C# Web Development with ASP.NET: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.