Ejemplo n.º 1
0
        // ========================================================================================
        void ToStringExample()
        {
            int number = 10;

            Console.WriteLine(number.ToString());

            Customer3 c1 = new Customer3();

            c1.FirstName = "Simon";
            c1.LastName  = "Tan";

            Console.WriteLine(c1.ToString());
            Console.WriteLine(Convert.ToString(c1));
        }
Ejemplo n.º 2
0
        // ========================================================================================
        void EqualsExample()
        {
            // No need for overloading
            //Direction dir1 = Direction.East;
            //Direction dir2 = Direction.East;
            //Console.WriteLine(dir1 == dir2);
            //Console.WriteLine(dir1.Equals(dir2));

            Customer3 c1 = new Customer3();

            c1.FirstName = "Simon";
            c1.LastName  = "Tan";

            Customer3 c2 = new Customer3();

            c2.FirstName = "Simon";
            c2.LastName  = "Tan";

            Console.WriteLine(c1 == c2);
            Console.WriteLine(c1.Equals(c2));
        }
        // ========================================================================================
        void ToStringExample()
        {
            int number = 10;
            Console.WriteLine(number.ToString());

            Customer3 c1 = new Customer3();
            c1.FirstName = "Simon";
            c1.LastName = "Tan";

            Console.WriteLine(c1.ToString());
            Console.WriteLine(Convert.ToString(c1));
        }
        // ========================================================================================
        void EqualsExample()
        {
            // No need for overloading
            //Direction dir1 = Direction.East;
            //Direction dir2 = Direction.East;
            //Console.WriteLine(dir1 == dir2);
            //Console.WriteLine(dir1.Equals(dir2));

            Customer3 c1 = new Customer3();
            c1.FirstName = "Simon";
            c1.LastName = "Tan";

            Customer3 c2 = new Customer3();
            c2.FirstName = "Simon";
            c2.LastName = "Tan";

            Console.WriteLine(c1 == c2);
            Console.WriteLine(c1.Equals(c2));
        }