InheritanceAndPolymorphism.LocalCourse.ToString C# (CSharp) Method

ToString() public method

public ToString ( ) : string
return string
        public override string ToString()
        {
            return this.ToStringHelper(new KeyValuePair<string, string>("Lab", this.Lab));
        }
    }

Usage Example

Ejemplo n.º 1
0
        static void Main()
        {
            LocalCourse localCourse = new LocalCourse("Databases");

            Console.WriteLine(localCourse.ToString());

            localCourse.Lab = "Enterprise";
            Console.WriteLine(localCourse.ToString());

            localCourse.Students = new List <string>()
            {
                "Peter", "Maria"
            };
            Console.WriteLine(localCourse.ToString());

            localCourse.TeacherName = "Svetlin Nakov";
            localCourse.Students.Add("Milena");
            localCourse.Students.Add("Todor");
            Console.WriteLine(localCourse.ToString());

            OffsiteCourse offsiteCourse = new OffsiteCourse(
                "PHP and WordPress Development", "Mario Peshev",
                new List <string>()
            {
                "Thomas", "Ani", "Steve"
            });

            Console.WriteLine(offsiteCourse.ToString());
        }
All Usage Examples Of InheritanceAndPolymorphism.LocalCourse::ToString