using System;
namespace CsharpStepByStep
...{
/**//// <summary>
/// Program 的摘要说明。
/// </summary>
public class Person
...{
private string name;
public Person(string Name)
...{
name = Name;
}
public string Name
...{
get ...{return name;}
}
}
public class Authors
...{
private Person[] persons = new Person[5];
public Person this[int index]
...{
get ...{return persons[index];}
set ...{persons[index]=value;}
}
}
public class SingleIndexer
...{
public static void Main()
...{
Authors authors = new Authors();
authors[0] = new Person("aa");
authors[1] = new Person("bb");
authors[2] = new Person("cc");
authors[3] = new Person("dd");
authors[4] = new Person("ee");
for(int i=0;i<5;i++)
...{
Console.WriteLine(authors[i].Name);
}
Console.ReadLine();
}
}
}

被折叠的 条评论
为什么被折叠?



