使用泛型 类型System.Collections.Generic.KeyValuePair需要2个类型参数
来源:互联网 发布:1962中印战争 知乎 编辑:程序博客网 时间:2024/06/08 11:04
c#在准备使用System.Collections.Generic.KeyValuePair遍历的Hashtable时候,代码却提示有错误:
这其实是个非常简单的错误,Eclipse中通过工具弹出的提示解决方法,点下鼠标就能解决问题的,Visual Studio 2010却不行。
不过提示也说的比较清楚了,需要指定两个参数的类型。
根据你的Hashtable中保存的Key和Value的数据类型指定就可以了。
例如:
KeyValuePair<string, int>KeyValuePair<int, int>KeyValuePair<int, long>
等等,主要看你Hashtable中保存的Key和Value的数据类型,第一个参数对应Key,第二个参数对应Value。
1 0
- 使用泛型 类型System.Collections.Generic.KeyValuePair需要2个类型参数
- MSDN:使用泛型 类型“System.Collections.Generic.IComparer <T> ”需要“1”个类型参数”。
- 使用泛型类型System.Collections.Generic.Icomparer <T> 需要一个类型参数
- error C3225: generic type argument for 'T' cannot be 'System::Collections::Generic::KeyValuePair ^',
- 为什么要使用using System.Collections.Generic;?
- C#泛型集合 using System.Collections.Generic
- C#泛型集合 using System.Collections.Generic
- C#泛型集合 using System.Collections.Generic
- 定义泛型集合的命名空间:System.Collections.Generic
- 获得泛型(generic class)参数类型T的实际类型(actual type)
- System.Collections.Generic
- 根据给出的值、判断是否构成三角形及类型using System; using System.Collections.Generic; using System.Linq; using System.T
- System.Collections、System.Collections.Generic、System.Collections.Specialized
- System.Collections.Generic 命名空间
- System.Collections.Generic命名空间
- System.Collections.Generic 命名空间
- System.Collections.Generic 命名空间
- 尽可能使用泛型方法,除非需要将类型参数用于实例的字段
- 用java写一个万年历
- 香港1997年是怎样被索罗斯击败的
- android-Intent
- 杭电1465 不容易系列之一
- Ubuntu中Nginx的安装与配置
- 使用泛型 类型System.Collections.Generic.KeyValuePair需要2个类型参数
- MATLAB批处理.mat文件
- 设计模式 笔记 迭代器模式 Iterator
- 图解Linux中EXT4与EXT3的区别
- 关于web开发前期工作的一点想法
- c# for 应输入;
- ANT(4) 编译 打包第三方jar包
- CodeForces 520B【Two Buttons】
- centos 6.0 如何安装中文输入法