static void Main(string[] args) { MyComplexClass myObj = new MyComplexClass(); WriteLine(myObj.ToString()); ReadKey(); }
static void Main(string[] args) { MyComplexClass myObj = new MyComplexClass(); WriteLine(myObj.ToString());//ToString 将对象的类名以字符串形式返回 ReadKey(); }
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(); }
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(); }
static void Main(string[] args) { MyComplexClass myObj = new MyComplexClass(); Console.WriteLine(myObj.ToString()); }