托管 C++ 中的泛型泛型
我想在托管 C++ 项目中创建一个 KeyValuePair 的列表。 这是我正在使用的语法
List<KeyValuePair<String^, String^>^>^ thing;
,但出现以下错误:
错误 C3225:“T”的泛型类型参数不能是“System::Collections::Generic::KeyValuePair ^”,它必须是值类型或引用类型的句柄
我基本上想这样做(C#)
List<KeyValuePair<string, string>> thing;
,但在托管C++。 哦,在 .Net 2.0 中。 有接受者吗?
I want to create a List of KeyValuePairs in a managed C++ project. Here is the syntax I'm using
List<KeyValuePair<String^, String^>^>^ thing;
but I'm getting the following error:
error C3225: generic type argument for 'T' cannot be 'System::Collections::Generic::KeyValuePair ^', it must be a value type or a handle to a reference type
I basically want to do this (C#)
List<KeyValuePair<string, string>> thing;
but in managed C++. Oh and in .Net 2.0. Any takers?
弄清楚:
KeyValuePair 本身不需要是句柄。 呃。
Figured it out:
KeyValuePair does not itself need to be a handle. Duh.