面向对象编程与代码组织
1. 命名空间与类型
在编程中,有许多常用的命名空间和对应的类型,如下所示:
| 命名空间 | 类型示例 |
| — | — |
| System.Net.Sockets | Socket, TcpClient, … |
| System.Data.SqlClient | SqlBulkCopy, SqlCommand, SqlConnection, SqlTransaction, … |
| System.Threading | Timer, WaitHandle, AutoResetEvent, ManualResetEvent, Mutex, Semaphore, … |
| System.Web.UI | Control, HttpApplication, … |
| System.Web.UI.WebControls | Button, CheckBox, DataGrid, … |
| System.Windows.Forms | Button, CheckBox, Cursor, Control, DataGrid, Form, … |
| Microsoft.Win32 | RegistryKey, … |
1.1 IDisposable 接口的判断
借助如 Visual Studio 这样的工具,能帮助我们判断一个类型是否实现了 IDisposable 接口。当将鼠标指针悬停在某个值上时,通常会在显示的信息中看到相关提示。
2. 运行时资源清理
2.1 自动清理情况
人
超级会员免费看
订阅专栏 解锁全文

1469

被折叠的 条评论
为什么被折叠?



