class kehu
{
    private String[] nameArr = new String[30];

    public void setNameArr(String name,int itm)
    {
        this.nameArr[itm] = name;
    }
    public String[] getNameArr()
    {
        return this.nameArr;
    }
}
kehu kehu = new kehu();
int i = 0;
while (true) {
    Console.WriteLine("请输入学生姓名");
    kehu.setNameArr(Console.ReadLine(),i);
    i++;
    Console.WriteLine("是否继续输入?");
    if (Console.ReadLine().Equals("y"))
    {
        continue;
    }
    else
    {
        break;
    }
}
Console.WriteLine("学生列表");
String[] Arr = kehu.getNameArr();
foreach (var item in Arr)
{
    Console.Write(item+"   ");
}
Console.WriteLine("");
Console.WriteLine("请输入要修改学生的姓名:");
String oldName = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("请输入新的学生姓名:");
String newName = Console.ReadLine();
Boolean status = false;
for (int j = 0; j < Arr.Length; j++)
{
    if (Arr[j].Equals(oldName))
    {
        Arr[j] = newName;
        status = true;
        break;
    }
}
if (status)
{
    foreach (var item in Arr)
    {
        Console.Write(item + "   ");

    }
}
else
{
    Console.WriteLine("没有找到该学生!");
}