是否有可能获取作为字符串表示形式返回的对象实例,例如“0x12345678”还是“12345678”?
像这样的伪代码:
string myObjectsInstanceAsAString = myObject.instance.ToString();
谢谢
最佳答案
您需要 override
ToString()
method
对于 object
type
.
public override string ToString(){
// do implementation here
}
关于c# - 如何将对象的实例作为字符串获取?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16150106/