摘要:
class DictionaryExample { public static void Main() { Dictionary<int, string> dicStudents = new Dictionary<int, string>(); dicStudents.Add(1, "李刚"); dicStudents.Add(2, "黄何军"); dicStudents.Add(3, "方如波"); dicStudents.Add(4, "陆前霖"); dicStudents.Add(5, 阅读全文
摘要:
GC.Collect()//强制垃圾回收器立即回收GC.SuppressFinalize(this)//请求系统不要调用指定对象的终结器 阅读全文
摘要:
class ServiceException:Exception { private string message; public ServiceException() : base() { } public ServiceException(string msg) : base(msg) { this.message = msg; } public ServiceException(string msg, Exception InnerException) : base(msg, InnerException) { this.message = msg; } } 阅读全文
摘要:
/volidatile关键字的使用,动手便代码实例操作class SchoolBus { volatile private bool isAlive;//关键字volatile表明该变量是活动的,确保在每一个线程在访问isAlive在每一个时刻都能得到最新的值 public SchoolBus(bool isAlive) { this.isAlive = isAlive; } public void Start() { Console.Write("The school bus is starting..."); Thread.Sleep(3000); Running(); 阅读全文