首页 > 其他 > 详细

C#索引器及示例

时间:2014-03-05 06:03:13      阅读:228      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
  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;
            }
        }
    }
bubuko.com,布布扣

C#索引器及示例,布布扣,bubuko.com

C#索引器及示例

原文:http://www.cnblogs.com/fang-beny/p/3580709.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!