1. Computing

Using Attributes in VB.NET

From Dan Mabbutt, About.com GuideJanuary 31, 2011

Follow me on:

Store and use information in the assembly metadata.

You see them frequently, especially in more advanced code examples that you might copy out for your own use. SerializableAttribute is one of the most common:

' Instances of this class
' need to be serialized
<Serializable()> _
Public Class theClass
' Code in the class
End Class

But you might not have figured out exactly what an attribute is. This article tells you.

You can go further and define your own custom attributes too. But the concept can be fuzzy. (Readers of this site may recall that I got confused about that myself in a recent blog.) But all of the examples of custom attributes that I have found have been a little, well, "artificial" and seemed slightly useless. Microsoft has done a good job of including all of the good ones in .NET already as "predefined" attributes.

I think I found one that might be useful to people in their own systems, however. I completed the code for it but it would make this article too long so I'll put it in a new article that will be online soon. In the meantime, I describe it at the end of this article. Let me know if you think I have a good idea; or if you think you have an even better one!

Attributes in VB.NET

Comments
No comments yet.  Leave a Comment
Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>
Top Related Searches lunes enero attributes

©2013 About.com. All rights reserved.