更新时间:2023-02-09 15:25:21
你需要将对象转换回其本机类型,或者对象的本机类型继承的接口类型,因此其成员将公开。 br />
如果你知道......可以搞清楚......那是什么类型:NativeType响应= client.Co nsultPerson(43812941);
或
You need to cast the object back into its "native Type," or the Type of the Interface the object's "native Type" inherits from, so its members will be exposed.
If you know ... can figure out ... what that Type is:NativeType response = client.ConsultPerson("43812941");
or
NativeType response = client.ConsultPerson("43812941") as NativeType;<br />
<br />
if(response == null) // either object is null, or error in cast
如果你不知道要把它投射到什么类型:在Visual Studio中:
1.在你引用的代码行之后设置一个断点。
2.当你运行代码时,点击断点:
a。打开'立即窗口并输入:?回复
或输入:? response.GetType()
b。查看'立即窗口中的结果:尝试从你看到的内容中找出原生类型。
If you don't know what Type to cast it to: In Visual Studio:
1. set a break-point after the line of code you cite.
2. when you run the code, and hit the break-point:
a. open the 'Immediate window and type: ? response
or type: ? response.GetType()
b. look at the result(s) in the 'Immediate window: try and figure out the native Type from what you see.