1: static void ObjectFunctionality() {
2: int a = 12;
3: Console.WriteLine("=> System.Object Functionality:");
4: Console.WriteLine("12.GetHashCode()={0}",a.GetHashCode());
5: Console.WriteLine("12.Equals(23)={0}",a.Equals(23));
6: Console.WriteLine("12.GetType()={0}",a.GetType());
7: Console.WriteLine("12.GetTypeCode()={0}",a.GetTypeCode());
8: Console.WriteLine("12.ToString()={0}",a.ToString());
9: Console.WriteLine("12.CompareTo(11)={0}",a.CompareTo(11));
10: Console.WriteLine("12.CompareTo(23)={0}", a.CompareTo(23));
11: Console.WriteLine("12.CompareTo(12)={0}", a.CompareTo(12));
12: }
结果:
数值数据类型的成员:
1: static void DataTypeFunctionality() {
2: Console.WriteLine("Max of int:{0}",int.MaxValue);
3: Console.WriteLine("Min of int:{0}",int.MinValue);
4: Console.WriteLine("Max of double:{0}",double.MaxValue);
5: Console.WriteLine("Min of double:{0}",double.MinValue);
6: Console.WriteLine("double.PositiveInfinity,double的正无穷大:{0}",double.PositiveInfinity);
7: Console.WriteLine("double的负无穷:{0}",double.NegativeInfinity);
8: Console.WriteLine("大于零的最大double的值",double.Epsilon);
9:
10: }
结果: