摘要:
索引器(indexer)是一种特殊的类方法 ,允许使用一个看起来像获取数组元素一样的方法来访问类的内部数据 。下面使用BitList类来演示 indexer的简单用法 。 在BitList类中 ,索引器返回 number 域 第 i 个比特位(bit)的值 。 public class BitList { private BitList() { } private static BitList instance; //获取单实例 public static BitList GetInstance... 阅读全文