class Programs { public static void OP() { Student[] stuinfo = new Student[] { new Student("HB001","Tom",'男',20,new List(new Archement[]{ new Archement("HB001","大学数学",88),new Archement("HB001","大学语文",88)})), new Student("HB002","Lucy",'女',23,new List (new Archement[]{ new Archement("HB002","大学数学",88),new Archement("HB002","大学语文",88)})), new Student("HB003","Peter",'男',27,new List (new Archement[]{ new Archement("HB003","大学数学",88),new Archement("HB003","大学语文",88)})), new Student("HB004","Bruce",'男',30,new List (new Archement[]{ new Archement("HB004","大学数学",88),new Archement("HB004","大学语文",88)})) }; foreach (var item in stuinfo) { Console.WriteLine("{0}\t{1}\t{2}\t{3}", item.StuID, item.StuName, item.StuSex, item.Age); foreach (var s in item.Score) { Console.WriteLine("{0}\t{1}", s.CourseName, s.Score); } } } } public class Student { public string StuID { get; set; } public string StuName { get; set; } public char StuSex { get; set; } public uint Age { get; set; } public List Score { get; set; } public Student(string ID, string Name, char Sex, uint Uage, List lst) { this.StuID = ID; this.StuName = Name; this.StuSex = Sex; this.Age = Uage; Score = new List (); foreach (var item in lst) { this.Score.Add(item); } } } public class Archement { public string StuNo { get; set; } public string CourseName { get; set; } public double Score { get; set; } public Archement(string ID, string Name, double DScore) { this.StuNo = ID; this.CourseName = Name; this.Score = DScore; } }