public class IndexSeletor<T> where T:struct { private List<T> _listObj; public IndexSeletor(List<T> listParm) { this._listObj = listParm; } public T this[int index] { get { if (index >= 100) return _listObj[index]; else return default(T); } set { if (index >= 100) _listObj[index] =value; } } }
原文:http://www.cnblogs.com/fang-beny/p/3580709.html