Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("***** Fun with System.Object *****\n");
            Persons p1 = new Persons();

            // Use inherited members of System.Object.
            Console.WriteLine("ToString: {0}", p1.ToString());
            Console.WriteLine("Hash code: {0}", p1.GetHashCode());
            Console.WriteLine("Type: {0}", p1.GetType());
            // Make some other references to p1.
            Persons p2 = p1;
            object  o  = p2;

            // Are the references pointing to the same object in memory?
            if (o.Equals(p1) && p2.Equals(o))
            {
                Console.WriteLine("Same instance!");
            }
            Console.ReadLine();
        }