do we suports Structures in vb.net, similar to C -
Struct
{
}
let me know if someone knows an answer to this.
Printable View
do we suports Structures in vb.net, similar to C -
Struct
{
}
let me know if someone knows an answer to this.
yes vb does take a look
http://msdn.microsoft.com/library/de...mStructure.asp
This structure thing in VB.net actually supports methods and stuff, means that i behaves exactly like a class with the only difference that the struct cannot inherit information.
then under what cases would i decide on the difference between a structure and a class?
Structure is a value type.
class is a reference type.
That means that structure is more effective - when boxing isn't needed.
Boxing is what happens when you need to treat a value type as reference type.
There is plenty of material on that subject on the net.
Structures are generally good for simple, relatively small data types, particularly with value-type fields, that do not need to be inherited and do not require a constructor with no arguments.