11.3 Class and struct differences
Visual Studio .NET 2003
Structs differ from classes in several important ways:
- Structs are value types (Section 11.3.1).
- All struct types implicitly inherit from the class
- Assignment to a variable of a struct type creates a copy of the value being assigned (Section 11.3.3).
- The default value of a struct is the value produced by setting all value type fields to their default value and all reference type fields to
- Boxing and unboxing operations are used to convert between a struct type and
- The meaning of
thisis different for structs (Section 11.3.6).
- Instance field declarations for a struct are not permitted to include variable initializers (Section 11.3.7).
- A struct is not permitted to declare a parameterless instance constructor (Section 11.3.8).
- A struct is not permitted to declare a destructor (Section 11.3.9).