17
13.1 理解接口 ····························································································································· 259
13.1.1
定义接口
······················································································································ 260
13.1.2
实现接口
···················································································································· 260
13.1.3
通过接口来引用一个类
····························································································· 262
13.1.4
使用多个接口
············································································································ 262
13.1.5
显式实现接口
············································································································ 263
13.1.6
接口的限制
················································································································· 264
13.1.7
定义和使用接口
········································································································· 265
13.2 抽象类 ································································································································· 273
13.2.1
抽象方法
····················································································································· 275
13.3 密封类 ································································································································· 275
13.3.1
密封方法
····················································································································· 275
13.3.2
实现并使用一个抽象类
································································································· 276
第 13 章快速参考 ·························································································································· 280
第 14 章 使用垃圾回收和资源管理 ······················································································· 281
14.1 对象的生存期 ····················································································································· 281
14.1.1
编写析构器
················································································································· 283
14.1.2
为什么要使用垃圾回收器
·························································································· 285
14.1.3
垃圾回收器的工作机理
······························································································ 287
14.1.4
慎用析构器
················································································································· 287
14.2 资源管理 ····························································································································· 289
14.2.1 disposal
方法
··············································································································· 289
14.2.2
异常安全的
disposal
方法
·························································································· 290
14.2.3 using
语句
···················································································································· 290
14.2.4
从析构器中调用
Dispose
方法
··················································································· 293
14.3 实现异常安全的 DISPOSAL ···································································································· 294
第 14 章快速参考 ·························································································································· 296
第 III 部分 创建组件 ·············································································································· 298
第 15 章 实现属性以访问字段 ······························································································· 298
15.1 使用方法来实现封装 ········································································································· 299
15.2 什么是属性 ························································································································· 301
15.2.1
使用属性
····················································································································· 302
15.2.2
只读属性
····················································································································· 303
15.2.3
只写属性
····················································································································· 303
15.2.4
属性的可访问性
········································································································· 304
15.3 理解属性的局限性 ············································································································· 305