ToString() публичный Метод

public ToString ( ) : string
Результат string
Пример #1
0
        public static void Main(string[] args)
        {
            Person personWithAge = new Person("Unufri", 12);
            Person personWithoutAge = new Person("Ani");

            Console.WriteLine(personWithAge.ToString());
            Console.WriteLine(personWithoutAge.ToString());
        }
Пример #2
0
        static void Main(string[] args)
        {
            Person zhivko = new Person("Zhivko", 99, "*****@*****.**");
            Person ivan = new Person("Ivan", 11);

            Console.WriteLine(zhivko.ToString());
            Console.WriteLine(ivan.ToString());
        }
Пример #3
0
        static void Main()
        {
            Person person1 = new Person("Nashmat", 18, "*****@*****.**");
            Console.WriteLine(person1.ToString());

            Person person2 = new Person("Onufrey", 21);
            Console.WriteLine(person2.ToString());

            //Person person3 = new Person("Mircho", 101);
            //Console.WriteLine(person3.ToString());
        }
        public static void Main(string[] args)
        {
            Console.Write("Please, enter a name: ");
            var name = Console.ReadLine();
            Console.Write("Please, enter a a value for age: ");
            var age = int.Parse(Console.ReadLine());
            Console.Write("Please, enter an email: ");
            var email = Console.ReadLine();

            Person firstPerson = new Person(name, age, email);
            //Person secondPerson = new Person("Stoqn", 22);

            Console.WriteLine(firstPerson.ToString());
            //Console.WriteLine(secondPerson.ToString());
        }
Пример #5
0
 static void Main()
 {
     Person pesho = new Person("Pesho", 22, "*****@*****.**");
     Console.WriteLine(pesho.ToString());
 }
        public static void Main()
        {
            var person = new Person("Joe", 25, "*****@*****.**");

            Console.WriteLine(person.ToString());
        }