这是索引器的语法
get 

return a[index]; 
} 返回a[i]值set 

if(index>0&&index<100) 
a[index] = value; 

如果i大于0并且小于100,那么把值赋进去。

解决方案 »

  1.   

    CSchedule   为一个已经定义好的类,这段话应该如何理解啊?谢谢?
    ==
    索引器,可以对一个对象象数组一样使用下标如果CSchedule   换成int呢?那应该如何理解啊?谢谢了!
    ==
    不可以
      

  2.   


    public class CA
    {
        CSchedule[] a=new CSchedule[99]
        public CSchedule this[int index]   
        {   
            get   
            {   
                return   a[index];   
            }   
            set   
            {   
                if(index> 0&&index <100)   
                    a[index] = value;   
            }   
        }
    }CA A=new CA();  
    A[1]=new CSchedule();
    CSchedule C=A[1];