解决方法
Sometimes when I call the
ToString
method it returns the fully qualified name of the runtime type of the object that received the call.@H_301_10@
正确.@H_301_10@
But for some types,such as
System.Int32
,ToString
returns the value of the receiver converted to a string.@H_301_10@
正确.@H_301_10@
Does the
System.Int32
struct override theToString
method?@H_301_10@
是.@H_301_10@
Do other types whose
ToString
methods return the fully-qualified type name not overrideToString
?@H_301_10@
情况可能就是这样,是的.当然,他们可以覆盖该方法并使覆盖方法与基类方法完全相同,但这有点无意义.@H_301_10@
So in those cases,calling
ToString
just calls theSystem.Object
implementation ofToString
,which returns fully qualified name?@H_301_10@
正确.@H_301_10@
你似乎已经掌握了它是如何工作的.我唯一的修正是要注意System.Int32是一个结构,而不是一个类.@H_301_10@