advertisement
Login | Register   
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   TIP BANK
Browse DevX
Partners & Affiliates
advertisement
advertisement
advertisement
advertisement
 

Get Personal with C# Custom Attributes

C# attributes may seem like an insignificant element of C# grammar, but did you know they provide a powerful way to extend your metadata? This goes a long way towards simplifying component-based programming. Here's what you need to know about custom attributesand how to use them.  


advertisement
henever I bump into one of my Java friends, he invariably tells me C# is no better than Java. I generally reply that one of my favorite features of C# is custom attributes. This tends to cut the Java versus C# debate short, since it's clear that custom attributes are very useful and dearly missed in Java. Indeed, while attributes may seem like a relatively insignificant element of C# grammar, they can dramatically ease your development. This article describes what custom attributes are, the different kind of attributes, and creative ways to use them.

Custom Attributes Defined
In source code-based programming, you annotate your code using comments. This is just fine because whoever reuses your code will see these annotations. However, in component-based programming, the metadata replaces the source file as the method of reuse. Custom attributes are extensions of the metadata that survive compilation and are therefore visible by the client even if he doesn't have access to the source code.


It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com.
Already a member?



advertisement