存放在C#中重复的键值对 [英] Storing duplicate key value pairs in C#
本文介绍了存放在C#中重复的键值对的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个数据就像在(字符串,整数)对。如何存储在集合对象的该数据。这两个值可以是重复的。其中集合对象我应该使用?
编辑:我怎样才能访问元素
分别??
块引用>
解决方案您可以使用
列表< KeyValuePair<字符串,整数>>
。
这将存储
KeyValuePair </ code>的列表,可以重复的。
I have a data like in (string , int) pair. How to store this data in collection object. Both values can be duplicate. Which collection object should i use??
EDIT: How can i access elements separately..??
解决方案You can use
List<KeyValuePair<string,int>>
.This will store a list of
KeyValuePair
's that can be duplicate.这篇关于存放在C#中重复的键值对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文