当前位置: 首页>>代码示例>>C#>>正文


C# Course.ListStudents方法代码示例

本文整理汇总了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();
        }
开发者ID:alban316,项目名称:edxCSharp,代码行数:44,代码来源:Program.cs


注:本文中的Course.ListStudents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。