advertisement
Login | Register   
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   TIP BANK
Browse DevX
Download the sample code for this article.
Partners & Affiliates
advertisement
advertisement
advertisement
advertisement
 

Decorate Your Code with Astonishing Attributes

Attributes provide extra information about your code that allows tools such as Visual Studio to make using your code easier. For example, they tell the Properties window how to display and edit properties and they let you fine-tune XML serialization. 


advertisement
hen I first saw attributes in Visual Studio .NET, I thought they were some sort of oddity Microsoft had dragged in from Java, C++, or perhaps the Delta Quadrant. They clearly aren't Visual Basic code. To someone who uses angle brackets only for comparing two numbers, this Property statement, <XmlIgnore(True)> Public Property Salary() As Decimal, looks like it's been infected by the Borg!


In fact, attributes don't look like code because they aren't code. They're really code "decorations" that supply extra information related to the code to anyone or any process that cares. Generally, these attributes are useful to entities that manipulate code and objects in interesting ways—such as Visual Studio's Properties window, the debugger, and XML serializers.

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