摘要:
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(); 阅读全文
摘要:
方法注释的使用/// <summary> /// 添加节点,将一个用户的基本信息添加到树中 /// </summary> /// /// <remarks> /// 该remarks是对summary的一个补充说明 /// 创建者:甘全福 /// 日期:2013-4-2 /// </remarks> /// <param name="num">创建节点的总数</param> /// <param name="strName">表示用户名</param> /// 阅读全文