O'Reilly logo

Special Edition Using C# by NIIT

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Structs

Structs are value types. Structs, like classes, act as container objects for many kinds of member data. They can implement constructors, constants, fields, methods, properties, indexers, operators, and nested types. In short, structs can support all the features that classes support. The differences between structs and classes are very few. Classes are reference types and therefore only references to data are stored in them. However, structs, being value types, can store the actual data. Structs are created on the stack. Therefore, structs enhance performance when compared to classes. Classes are created on the heap and are hence slower that structs. Classes compensate for their lack of speed by being able to inherit from other classes. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required