摘要: 你可以创建一个hashtable: 你可以使用foreach方法,把hashtable的key与value循环写出来: 在控制台屏幕输出: 如果只需把key输出: 如果只想把值循环输出: 测试输出结果: 往hashtable集合添加key与value: 有添加就是移除: 测试上面的添加Add和移除: 阅读全文
posted @ 2017-12-12 23:47 Insus.NET 阅读(761) 评论(0) 推荐(2) 编辑
摘要: 昨天有写过一个单例模式的练习。《单例模式(C#)》 写得较为复杂,今天再使用另外的方法来实现: class Au { private static readonly Au instance = new Au(); public static Au Instance { get { return in 阅读全文
posted @ 2017-12-12 12:00 Insus.NET 阅读(577) 评论(1) 推荐(1) 编辑
摘要: 在C#中,我们对集合的数据,可以创建一个索引器的方法来访问集合。如: class AS { public string[] Autos = { "德系","欧系","美系","日系","韩系"}; public string this[int index] { get { return Autos[ 阅读全文
posted @ 2017-12-12 10:48 Insus.NET 阅读(409) 评论(1) 推荐(1) 编辑