【发布时间】:2012-07-20 06:47:36
【问题描述】:
我正在尝试从中获取价值
IKeyValuePair<Platform::Guid,Platform:: Object>
例如,我有一个名为 SomeApi() 的 Api,它返回 IKeyValuePair<Platform::Guid,Platform:: Object>
C++ 代码:
auto res = SomeApi();
String ^str = res->key; // I am able to get Guid Here
现在如何从中获得价值
res->value 返回对象,但如何知道对象的类型并从中获取值。
如果我这样做
String^ value = res->value.ToString(); // this returns something else not value
请通过代码解释我如何从IKeyValuePair 获得价值。
【问题讨论】:
-
下次不要用auto,你会发现原因的。