摘要: 一直觉得c#中的get,set访问器是个好东西,能很好的完成数据读取和写入的其他附加操作,这对于数据同步等都是很方便的。 可是,前段时间的一个类中有List泛型,这个的get,set如何写呢?一开始死活找不到答案 后来在一个实例代码中,看到原来是这么写的 public DrawObject this[int index] { get { if (index < 0 || index >= graphicsList.Count) return null; return graphicsList[index]; } } 恍然大悟,呵呵~~ 阅读全文
posted @ 2011-08-03 11:12 FerventDesert 阅读(500) 评论(0) 推荐(0) 编辑