【C # valuetypes]
1. What types are valuetype?
The value types consist of two main categories:
Structs fall into these categories:
Numeric types
Integral types
Floating-point types
Decimal
Bool
User Defined structs.
2. the built-in C # value type is actually the alias of the C # built-in class. For example:
3. the C # type keywords and their aliases are interchangeable.
4. The following two types of initialization are: one will call the constructor initialization, and the other will not.
Int Myint;
Myint = new int (); // invoke default constructor for int type.
5. data types are separatedValue typesAndReference types. Value types are eitherStack-allocatedOr allocated inline in a structure. reference types areHeap-allocated. Both reference and value types are derived from the ultimate base class object. in cases where it is necessary for a value type to behave like an object, a wrapper that makes the value type look like a reference object is allocated on the heap, and the value type's value is copied into it. the wrapper is marked so the system knows that it contains a value type. this process is known as boxing, and the reverse process is known as unboxing. boxing and unboxing allow any type to be treated as an object.
Although valuetype is the implicit base class for value types, you cannot create a class that inherits from valuetype directly. instead, individual compilers provide a language keyword or construct (such as struct in C # And structure... End structure in Visual Basic) to support the creation of value types.
Refer:
1. http://msdn.microsoft.com/zh-cn/library/ya5y69ds.aspx
2. http://msdn.microsoft.com/zh-cn/library/s1ax56ch.aspx
3. http://msdn.microsoft.com/zh-cn/library/system.valuetype (V = vs.110). aspx