public List<学生> 学生列表=new List<学生>();
public class 学生
{
public 学生(string 学号,string 姓名,int 年龄)
{
this.学号=学号;
this.姓名=姓名;
this.年龄=年龄;
}
public string 学号;
public string 姓名;
public int 年龄;
}
public 学生 呼叫学生(string 学号)
{
for(int i=0;i<学生列表.Count;i++)
{
if(学号==学生列表[i].学号)
return 学生列表[i];
}
return null;
}
public void 创建学生(string 学号,string 姓名,int 年龄)
{
if(呼叫学生(学号)==null)
{
学生 objectStudent=学生(学号,姓名,年龄);
学生列表.Add(objectStudent);
}
}
public int 获取学生人数()
{
return 学生列表.Count;
}