【发布时间】:2008-12-05 15:44:47
【问题描述】:
我还有另一个托管 C++ KeyValuePair 问题,我知道在 C# 中可以做什么,但是很难转换为托管 C++。这是我想在 C# 中执行的代码:
KeyValuePair<String, String> KVP = new KeyValuePair<string, string>("this", "that");
我已经将它反映到 MC++ 中并得到了这个:
KeyValuePair<String __gc*, String __gc*> __gc* KVP = (S"this", S"that");
我正在翻译的:
KeyValuePair<String ^, String ^> KVP = (gcnew String("this"), gcnew String("that"));
我从我的previous question 知道 KeyValuePair 是一个值类型;问题是它是 C++ 中的值类型和 C# 中的引用类型吗?谁能告诉我如何从 C++ 设置 KeyValuePair 的键和值?
【问题讨论】:
标签: .net generics visual-c++ .net-2.0 managed-c++