//定义一个索引器.需要用THIS关键字.. public student this[int index] { get {retuen students[index];} } public student this[string name] { get { int i; bool found =false; for(i=o;i<student.length;i++) { if(students[i].name==name) { found=trun; break; } } if(found) { return students[i]; } else { return null; } } }