All the reflection information we’ve seen so far is based on metadata that’s well known to the runtime. One typical example of such metadata includes the visibility of types and members. Early on in the design of the CLR, it was clear that an extensible metadata system would be a true added value to the new runtime. This ultimately resulted in the creation of custom attributes that allow developers to define their own pieces of metadata that can be tagged onto assemblies, types, and their members.
You’ve seen a couple of attributes earlier in this chapter when we were discussing MEF. In the following code fragment,
Export is an attribute:
[Export(typeof(ICalculation))]public class Pythagoras : ICalculation ...