error C3225: generic type argument for 'T' cannot be 'System::Collections::Generic::KeyValuePair ^',

//z 2012-6-19 14:38:56 PM IS2120@CSDN.T637923912

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

//z 2012-6-19 14:38:56 PM IS2120@CSDN.T637923912
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 does not itself need to be a handle. Duh.

Because it's a value type, not a reference type (i.e. struct instead of class in C#).


Figured it out:

List<KeyValuePair<String^, String^>>^ thing;

KeyValuePair does not itself need to be a handle. Duh.

//z 2012-6-19 14:38:56 PM IS2120@CSDN.T637923912

error C3191: '^' : incompatible with '/clr:oldSyntax' command line option

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值