Attributes and Reflection—Attributes

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
CSharp-Online.NET:Articles
C# Articles

Attributes and Reflection

© 2002 O'Reilly & Assoc., Inc.

Attributes

An attribute is an object that represents data you want to associate with an element in your program. The element to which you attach an attribute is referred to as the target of that attribute. For example, the attribute:

[NoIDispatch]

is associated with a class or an interface to indicate that the target class should derive from IUnknown rather than IDispatch when exporting to COM. COM interface programming is discussed in detail in Chapter 22.

In Chapter 17, you saw this attribute:

[assembly: AssemblyKeyFile("c:\\myStrongName.key")]

This inserts metadata into the assembly to designate the program's StrongName.


Previous_Page_.gif Next_Page_.gif


Personal tools