目录
版权所有 ©
©
©
© Microsoft
Microsoft
Microsoft
Microsoft Corporation
Corporation
Corporation
Corporation 1999-2010
1999-2010
1999-2010
1999-2010 。保留所有权利。
v
v
v
v
3.9 自动内存管理 .............................................................................................................................................. 73
3.10
执行顺序
.................................................................................................................................................... 75
4.
4.
4.
4.
类型
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
.................................................................................................................................................................... 77
77
77
77
4.1 值类型 .......................................................................................................................................................... 77
4.1.1 System.ValueType
类型
........................................................................................................................ 78
4.1.2 默认构造函数 ....................................................................................................................................... 78
4.1.3 结构类型 ............................................................................................................................................... 79
4.1.4 简单类型 ............................................................................................................................................... 79
4.1.5
整型
....................................................................................................................................................... 80
4.1.6
浮点型
................................................................................................................................................... 81
4.1.7 decimal
类型
......................................................................................................................................... 82
4.1.8 bool
类型
............................................................................................................................................... 82
4.1.9 枚举类型 ............................................................................................................................................... 82
4.1.10
可以为
null
的类型
............................................................................................................................. 83
4.2 引用类型 ...................................................................................................................................................... 83
4.2.1 类类型 ................................................................................................................................................... 84
4.2.2 对象类型 ............................................................................................................................................... 84
4.2.3 dynamic 类型 ........................................................................................................................................ 84
4.2.4 string
类型
............................................................................................................................................. 85
4.2.5
接口类型
............................................................................................................................................... 85
4.2.6
数组类型
............................................................................................................................................... 85
4.2.7 委托类型 ............................................................................................................................................... 85
4.3 装箱和拆箱 .................................................................................................................................................. 85
4.3.1 装箱转换 ............................................................................................................................................... 85
4.3.2 拆箱转换 ............................................................................................................................................... 87
4.4
构造类型
...................................................................................................................................................... 87
4.4.1
类型实参
............................................................................................................................................... 88
4.4.2
开放和封闭类型
................................................................................................................................... 88
4.4.3 绑定和未绑定类型 ............................................................................................................................... 89
4.4.4
满足约束
............................................................................................................................................... 89
4.5 类型形参 ...................................................................................................................................................... 90
4.6 表达式树类型 .............................................................................................................................................. 91
4.7 dynamic 类型 ............................................................................................................................................... 91
5.
5.
5.
5. 变量 ....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
.................................................................................................................................................................... 93
93
93
93
5.1
变量类别
...................................................................................................................................................... 93
5.1.1 静态变量 ............................................................................................................................................... 93
5.1.2
实例变量
............................................................................................................................................... 93
5.1.2.1 类中的实例变量 ............................................................................................................................. 93
5.1.2.2
结构中的实例变量
......................................................................................................................... 94
5.1.3 数组元素 ............................................................................................................................................... 94
5.1.4 值参数 ................................................................................................................................................... 94
5.1.5 引用形参 ............................................................................................................................................... 94
5.1.6 输出形参 ............................................................................................................................................... 94
5.1.7
局部变量
............................................................................................................................................... 95