Conclusion

 <  Day Day Up  >  

Attributes allow the .NET Framework and the programmer to define new kinds of information that can be specified on declarations without requiring changes in the language. Given their widespread use in the Framework, understanding how to apply attributes is important. Defining new attributes is primarily of interest to programmers writing tools to analyze or process other assemblies. The next chapter covers another advanced topic: versioning.

Here are some style points to consider.

  • Instead of using the full name of an attribute, such as System.ThreadStaticAttribute , for readability and simplicity you can leave off the "Attribute" suffix when applying the attribute.

  • It is strongly recommended that attribute class names always end in "Attribute." When looking for an attribute with a particular name, the compiler will first look for the name with "Attribute" added to the end and, if that fails, will look up the name as provided. This means that if an X attribute class and an XAttribute attribute class are defined, <X> will always refer to XAttribute and there will be no way to refer to X .

 <  Day Day Up  >  


The Visual Basic .NET Programming Language
The Visual Basic .NET Programming Language
ISBN: 0321169514
EAN: 2147483647
Year: 2004
Pages: 173
Authors: Paul Vick

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net