如何从 IKeyValuePair获取值
我试图从
IKeyValuePair<Platform::Guid,Platform:: Object>
Say 获取值,例如我有一个名为 SomeApi() 的 Api,它返回 IKeyValuePair
C++ 代码:
auto res = SomeApi();
String ^str = res->key; // I am able to get Guid Here
现在如何从中获取值
< code>res->value 返回对象,但如何知道对象的类型并从中获取值。
如果我这样做,
String^ value = res->value.ToString(); // this returns something else not value
请通过代码解释我如何从 IKeyValuePair
获取值。
I am trying to get the value from
IKeyValuePair<Platform::Guid,Platform:: Object>
Say for example I have Api Called SomeApi() which returns IKeyValuePair<Platform::Guid,Platform:: Object>
C++ Code:
auto res = SomeApi();
String ^str = res->key; // I am able to get Guid Here
Now How to get Value from it
res->value
returns object but how to know type of object and get the value from it.
if I do
String^ value = res->value.ToString(); // this returns something else not value
Please explain me through code how can i get value from IKeyValuePair
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该从 Platform::Object^ 转换为基础类型,例如:
You should cast from Platform::Object^ to the underlying type, eg: