0

我试图从中获得价值

IKeyValuePair<Platform::Guid,Platform:: Object>

比如说我有 Api Called SomeApi() 它返回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

4

2 回答 2

1

您应该从 Platform::Object^ 转换为基础类型,例如:

String^ value = safe_cast<String^>(res->value);
于 2012-07-19T22:47:36.980 回答
0
String^ value =  res->value->ToString();
于 2011-11-25T15:47:26.860 回答