C#基本语法复习-使用索引器

索引是使用this关键字来引入的,this关键词之前要指定返回值的类型,在后面的方括号中要指定索引器的索引使用值的类型;一个雷或节后中只能有一个索引;

public bool this [int index]
{
get{}set{}
}

接口中的索引:

interface Ia{
bool this [int index]{get;set;}
}

 

posted on 2015-04-04 14:34  阴晴撒哈拉  阅读(94)  评论(0编辑  收藏  举报

导航