All value types are derived implicitly from the System.ValueType.
Unlike reference types, it is not possible to derive a new type from a value type. However, like reference types, structs can implement interfaces.
Unlike reference types, it is not possible for a value type to contain the null value. However, the nullable types feature does allow values types to be assigned to null.
The value types consist of two main categories:
- Structs
- Enumerations
- Numeric types
- bool
- User defined structs.
you cannot use it before you initialize it. You can initialize it using the following statement:
myInt = new int(); // Invoke default constructor for int type.
which is equivalent to:
myInt = 0; // Assign an initial value, 0 in this example.
You can, of course, have the declaration and the initialization in the same statement like this:
int myInt = new int();