Exemple #1
0
        static void Main(string[] args)
        {
            MyComplexClass myObj = new MyComplexClass();

            WriteLine(myObj.ToString());
            ReadKey();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            MyComplexClass myObj = new MyComplexClass();

            WriteLine(myObj.ToString());//ToString 将对象的类名以字符串形式返回
            ReadKey();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            MyComplexClass myObj = new MyComplexClass();

            WriteLine(myObj.ToString());
            Program x = new Program();

            WriteLine(x.ToString());
            WriteLine(myObj.GetType());
            WriteLine(typeof(MyComplexClass));
            ReadKey();
        }
Exemple #4
0
        static void Main(string[] args)
        {
            MyComplexClass myObj = new MyComplexClass();

            WriteLine(myObj.ToString());
            WriteLine(myObj.GetHashCode());
            WriteLine(myObj.GetType());
            WriteLine(myObj.Equals(new object()));
            WriteLine(object.Equals(myObj, new object()));
            WriteLine(object.ReferenceEquals(myObj, myObj));
            MyComplexClass myObj2 = myObj.ShallowCopy();

            WriteLine(myObj2.ToString());
            WriteLine(myObj2.GetHashCode());
            WriteLine(object.ReferenceEquals(myObj, myObj2));
            WriteLine(myObj.Equals(myObj2));
            ReadKey();
        }
Exemple #5
0
        static void Main(string[] args)
        {
            MyComplexClass myObj = new MyComplexClass();

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