本文整理汇总了C#中Course.ListStudents方法的典型用法代码示例。如果您正苦于以下问题:C# Course.ListStudents方法的具体用法?C# Course.ListStudents怎么用?C# Course.ListStudents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course.ListStudents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
Student student1 = new Student();
student1.StudentFirstName = "John";
student1.StudentLastName = "Lennon";
student1.StudentBirthDate = DateTime.Parse("19/02/1945");
student1.StudentCity = "Liverpool";
student1.StudentCountry = "United Kingdom";
student1.AddGrades(10, 9.8, 8.7, 9, 8);
Student student2 = new Student();
student2.StudentFirstName = "Paul";
student2.StudentLastName = "Mcartney";
student2.StudentBirthDate = DateTime.Parse("10/06/1951");
student2.StudentCity = "Liverpool";
student2.StudentCountry = "United Kingdom";
student2.AddGrades(8, 10, 9.9, 10, 9.5);
Student student3 = new Student();
student3.StudentFirstName = "George";
student3.StudentLastName = "Harrison";
student3.StudentBirthDate = DateTime.Parse("22/09/1956");
student3.StudentCity = "Manchester";
student3.StudentCountry = "United Kingdom";
student3.AddGrades(9, 10, 10, 10, 8.5);
Course programmingWithC = new Course();
programmingWithC.Name = "Programming with C #";
programmingWithC.AddStudentToCourse(student1);
programmingWithC.AddStudentToCourse(student2);
programmingWithC.AddStudentToCourse(student3);
Console.WriteLine("The {0} course contains {1} student(s)", programmingWithC.Name, programmingWithC.StudentCourseCount.ToString());
Console.WriteLine("---------------------------------");
Console.WriteLine("Students in {0} course:", programmingWithC.Name);
programmingWithC.ListStudents();
Console.WriteLine("---------------------------------");
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Press any key to quit");
Console.ReadKey();
}