Sunday, 21 October 2012

VB.NET What are: Structures

Structures

Structures can be defined as a tool for handling a group of logically related data items. They are user-defined and provide a method for packing together data of different types. Structures are very similar to Classes. Like Classes, they too can contain members such as fields and methods. The main difference between classes and structures is, classes are reference types and structures are value types. In practical terms, structures are used for smaller lightweight objects that do not persist for long and classes are used for larger objects that are expected to exist in memory for long periods. We declare a structure in Visual Basic .NET with the Structure keyword.  
There are storage and performance advantages with Structures, often they are negligible.

Classes

Preffered by me.

Sources for this article:
http://msdn.microsoft.com/en-us/library/aa289521%28v=vs.71%29.aspx
http://www.startvbdotnet.com/oop/structure.aspx
and also we have nice article in code project
http://www.codeproject.com/Articles/8607/Using-Structures-in-VB-NET