These are the docs关于.ToString()提示了这个问题.他们说:
@H_502_2@
Because Object is the base class of all reference types in the .NET
Framework,this behavior [.ToString()] is inherited by reference types that do not
override the ToString method.
更进一步的说:
@H_502_2@For example,the base types such as Char,Int32,and String provide ToString implementations
但Int32是一个结构体,因此必须是一个值类型.
那么这里发生了什么? Int32实现它是非常自己的.ToString()与Object无关?
解决方法
Int32是一个结构体,因此是一个值类型.
但:
但:
System.Object System.ValueType System.Int32
Int32派生自System.ValueType,它本身来源于System.Object. Etvoilà…