社区
C#
帖子详情
如何获取集合类Dictionary中所有key的值(在线等!!!)
jinsuo_1986
2009-04-09 05:31:57
如题!
...全文
4770
8
打赏
收藏
如何获取集合类Dictionary中所有key的值(在线等!!!)
如题!
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
8 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
yobuke
2012-05-24
打赏
举报
回复
Dictionary<string, string> dic= new Dictionary<string, string>();
foreach (var item in
dic.Values
)
{
//Do sth.
}
yobuke
2012-05-24
打赏
举报
回复
Dictionary<string, string> dic= new Dictionary<string, string>();
foreach (var item in dic.Values)
{
//Do sth.
}
zisediao325
2011-03-15
打赏
举报
回复
恩 这个可以使用,只是想把它保存到数组里比较麻烦
blue601
2010-12-29
打赏
举报
回复
[Quote=引用 2 楼 zgke 的回复:]
Dictionary<string, string> _Dictionary = new Dictionary<string, string>();
foreach(string _Key in _Dictionary.Keys)
{
_Key
}
[/Quote]
这个我刚刚试过,没有问题 _Key就是你需要的键值
ljhcy99
2009-04-09
打赏
举报
回复
Dictionary <string, string> dic = new Dictionary <string, string>();
dic.keys
ojekleen
2009-04-09
打赏
举报
回复
[Quote=引用 1 楼 heyu52 的回复:]
Dictionary <string, string> dic = new Dictionary <string, string>();
dic.Values <--------值集合
[/Quote]
dic.keys<--------key集合
单个获取可以foreach
如果你的key是string 类型
foreache(string s in dic.keys)
{
console.writeline(s);
}
zgke
2009-04-09
打赏
举报
回复
Dictionary<string, string> _Dictionary = new Dictionary<string, string>();
foreach(string _Key in _Dictionary.Keys)
{
_Key
}
heyu52
2009-04-09
打赏
举报
回复
Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Values<--------值集合
C#入门必看实力程序100个
4. **数组与集合**:了解如何创建和操作数组,如一维数组、多维数组和泛型集合(List、
Dictionary
<T
Key
, TValue>)。 5. **面向对象编程**:C#是面向对象的语言,例子将展示类(class)、对象(object)、继承...
C#学编程从入门到实践【PPT课件】
4. **数组与集合**:了解不同类型的数组(一维、二维、多维)和集合(如List、
Dictionary
<T
Key
, TValue>)的使用。 5. **控制台应用**:通过Console.WriteLine()和Console.ReadLine()等函数进行简单的控制台交互。 ...
C# 编程从入门到精通
例如,了解集合框架(如List和
Dictionary
<T
Key
, TValue>)以及线程和并发编程,这些对于构建多任务和高性能的应用程序至关重要。 此外,C#与Windows Forms和WPF一起用于创建图形用户界面,而ASP.NET框架则用于开发...
【C#日常】C#泛型集合
Dictionary
<T
Key
, TValue>使用方法及泛型集合检查是否存在
Key
值
今天,我遇到了一个问题,就是使用集合
Dictionary
的时候,总是要先判断是否存在
Key
值
,然后再判断
Key
值
对应的
集合类
是否有
值
,这样就很麻烦,比如这样: 既要判断
Key
值
是否存在,又得判断这个
Key
值
对应的集合是否有...
【C#】根据名称
获取
编码(
Dictionary
获取
key
)
获取
编码 /// /// /// /// public static string Get
Dictionary
Key
(
Dictionary
, string> a_dic, string a_strValue) { return a_dic.FirstOrDefault((
Key
ValuePair, string> q) => q.Value == a_strValue)....
C#
111,098
社区成员
642,554
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章