Value Types - 值类型
值类型派生自System.ValueType。值类型的变量直接包含它们的值。
值类型的两大类别分别是:struct 和 enum。内建数字类型是:struct型。
值类型是封闭的,意味着此类不能被继承。不能定义派生自用户自定义类和struct的struct,因为struct只能派生自System.ValueType。
enum派生自System.Enum,System.Enum派生自System.ValueType。
Reference Types - 引用类型
刚声明的引用类型的值为:null 直到被分配对象。声明接口类型的变量,同时必须初始化为实现该接口的类。
数组是引用类型
Generic Types - 泛型
List<string> stringList = new List<string>();
stringList.Add("String example");
// compile time error adding a type other than a string:
stringList.Add(4);
Nullable Types
通常值类型不能分配null值,类型名称后,后缀? 此种情况可以分配null值,例如:int?