In Brief

In this chapter, we took a look at two important topics—attributes and reflection. Here's an overview of this chapter's coverage:

  • Attributes let you specify metadata, including directives to the compiler, in your code. Reflection is a set of techniques that lets an application read and work with its own metadata. Reflection is made up of four parts: accessing metadata, discovering and examining types, late binding, and reflection emit.

  • You can create your own custom metadata attributes with the [AttributeUsage] attribute, which you use on the class that holds the support code for the attribute. You can pass data to that class's constructor when you use the custom attribute, as well as set property values, like Text in this example we ...

Get Microsoft® Visual C#® .NET 2003 Kick Start 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.