Applied .Net Attributes 
Buy it at Amazon
Author Jason Bock, Tom Barnaby
Publisher APress
Length 232 pages
vbRad Rating: 4 fingers up. (4 out of 5)
Reviewed by Robert Gelb

.NET framework probably does not have a more mysterious aspect to it than attributes. Unless, you've been heavily programming in C++, most people don't really know what attributes do, how they do it, how one can write an attribute, etc…

This paperback is very thin, only 200 pages, for tech book industry, which is known for producing 1,000 page long tomes full of repeating junk (or same code replicated in c# and vb.net). Actually when I saw the title of the book, I was actually perplexed that it was that much. But that's because I didn't really know that much about attributes.

It turns out you can do a lot with attributes. In fact, this area is likely to be used exclusively by high-end programmers that can think outside the compilation box.

The authors cover 5 separate areas starting with Attribute fundamentals, then covering Compile-time and Design-time attributes, followed by the effect of attributes on runtime behaviour. Last 2 chapters deal with building and applying your attributes to code.

It would have been cool, if, for quick lookup, they had a Top 10 Attributes list and their uses, that are most likely to be used by programmers. Here is mine:

  1. DLLImport - declares a WinAPI dll (or any other plain DLL)
  2. StructLayout - indicates the layout of a C struct
  3. Serializable - allows the object to serialize
  4. Obsolete - tells the client of the object that the method is obsolete
  5. CLSCompliant - allows the framework to ignore compliancy issues
  6. Conditional - same #blah in vb6
  7. MarshalAs - converts data to and from standard win api structures
  8. JustInTimeActivation - allows object to participate in COM+ transactions
  9. AttributeUsage - defines how the attributes is to be used
  10. Declarative Security attributes - declares security permissions up front

All in all, good book if a bit too geared toward high-end developers.



Want more reviews and sample chapters? Click here.