摘要:
using System;namespace 异常{ class Program { static void Main(string[] args) { try { Test(); } catch (Exception exception) { Console.WriteLine(exception.Message); Console.WriteLine(e... 阅读全文
摘要:
这里有两种释放资源的写法,实现原理基本相同,但是第二种方法更利于扩展,如下所示:第一种方法的基类:using System;using System.IO;namespace Dispose模式{ public abstract class BaseClass : IDisposable { protected BaseClass(string name) { _count++; Index = _count; Name = name; } private st... 阅读全文