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


C# Student.ToString方法代码示例

本文整理汇总了C#中School.Student.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Student.ToString方法的具体用法?C# Student.ToString怎么用?C# Student.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在School.Student的用法示例。


在下文中一共展示了Student.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main()
        {
            //Students
            Student firstStudent = new Student("Pesho", "Kamburov", 1);
            Student secondStudent = new Student("Galin", "Imamov", 2);

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Students:");
            Console.ResetColor();
            Console.WriteLine(firstStudent.ToString());
            Console.WriteLine(secondStudent.ToString());
            //Teachers
            Teacher firstTeacher = new Teacher("Stefan", "Popov");
            firstTeacher.AddDiscipline(new Discipline("Math", 16, 10));
            firstTeacher.AddDiscipline(new Discipline("Physics", 20, 5));
            Teacher secondTeacher = new Teacher("Armin", "Van Buuren");
            secondTeacher.AddDiscipline(new Discipline("TechMusic", 15, 5));
            secondTeacher.AddDiscipline(new Discipline("Minimal", 18, 7));

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("\nTeachers:");
            Console.ResetColor();
            Console.WriteLine(firstTeacher.ToString());
            Console.WriteLine(secondTeacher.ToString());

            //School
            School school = new School();

            school.AddClass(new Class("12b", firstTeacher));
            school.AddClass(new Class("12a", secondTeacher));
        }
开发者ID:NikolaiMishev,项目名称:Telerik-Academy,代码行数:31,代码来源:ProgramMain.cs

示例2: CompareToString

        public void CompareToString()
        {
            var student = new Student("Marmalad Palachinkov");

            Assert.AreEqual("Marmalad Palachinkov - " + student.UniqueID, student.ToString(),
                "ToString is not returning in correct format.");
        }
开发者ID:Bvaptsarov,项目名称:Homework,代码行数:7,代码来源:StudentTest.cs

示例3: StudentToStringTest

 public void StudentToStringTest()
 {
     var student = new Student("Pesho", 12345);
     string expected = "Student name is: Pesho, with id: 12345";
     string actual = student.ToString();
     Assert.AreEqual(expected, actual);
 }
开发者ID:slop3n,项目名称:TelerikAcademy,代码行数:7,代码来源:StudentTest.cs

示例4: AddingStudent_CheckingIfHeExistInCourse

        public void AddingStudent_CheckingIfHeExistInCourse()
        {
            var course = new Course("Course");
            var student = new Student("Petkan");
            course.AddStudent(student);

            var index = course.ToString().IndexOf(student.ToString());
            Assert.IsTrue(index >= 0);
        }
开发者ID:Bvaptsarov,项目名称:Homework,代码行数:9,代码来源:CourseTest.cs

示例5: Main

        public static void Main()
        {
            Student dwayne = new Student("Pesho", "Peshov", 6);

            Console.WriteLine("Student name: {0}, Class number: {1}", dwayne.ToString(), dwayne.ClassNumber);

            Teacher firstTeacher = new Teacher(
                "Ivan",
                "Petkov",
                new Discipline("Math", 15, 20),
                new Discipline("Art", 10, 12));

            Console.WriteLine(firstTeacher.ToString());

            Teacher secondTeacher = new Teacher(
                "The",
                "Rock",
                new Discipline("Sports", 30, 40));

            School newSchool = new School(
                new Class("12a", firstTeacher),
                new Class("12b", secondTeacher));
        }
开发者ID:MichaelaIvanova,项目名称:Telerik-Academy,代码行数:23,代码来源:MainSystemSchool.cs

示例6: RemovingCorrectlyStudent_TrueIfRemovedCorrectly

        public void RemovingCorrectlyStudent_TrueIfRemovedCorrectly()
        {
            var spirt = new Course("Spirt");
            var student = new Student("sad");

            spirt.AddStudent(student);
            spirt.RemoveStudentByID(student.UniqueID);

            var index = spirt.ToString().IndexOf(student.ToString());
            Assert.IsTrue(index < 0);
        }
开发者ID:Bvaptsarov,项目名称:Homework,代码行数:11,代码来源:CourseTest.cs

示例7: TestStudentToString

        public void TestStudentToString()
        {
            Student misho = new Student("Misho Ivanov");

            Assert.AreEqual(
                string.Format("(Name = Misho Ivanov, UN = {0})", misho.Number),
                misho.ToString(),
                "Student.ToString() does not work correctly.");
        }
开发者ID:niki-funky,项目名称:Telerik_Academy,代码行数:9,代码来源:StudentTest.cs

示例8: TestStudentTostring

 public void TestStudentTostring() 
 {
     Student student = new Student("Nikolay Kostadinov",10000);
     Assert.AreEqual(student.ToString(), "10000; Nikolay Kostadinov", "Invalid String");
 }
开发者ID:NikolayKostadinov,项目名称:Homeworks,代码行数:5,代码来源:StudentTest.cs


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