什么是收藏最好的.NET类型,其中每个键可以有多个值? [英] What is the best .NET type for collections where each key can have multiple values?

查看:85
本文介绍了什么是收藏最好的.NET类型,其中每个键可以有多个值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该键一个键,但不同的值。我试过哈希表,但我不认为是这样做的正确方法。

I have one key but different values for that key. I tried HashTable but I don't think that is the right way of doing it.

我将详细解释的要求是什么:

I'll explain in detail what the requirement is:

我有钥匙 - Asp.net - 对,我有值的n个 - 61,67,100

I have a Key - "Asp.net" - for that I have n number of values - 61, 67, 100

所以我要保存这个地方,比如字典或哈希表

So I have to store this somewhere like Dictionary or hash table.

推荐答案

A 词典<字符串列表< INT>> 会做的伎俩为您的样品数据。

A Dictionary<string, List<int>> would do the trick for your sample data.

这篇关于什么是收藏最好的.NET类型,其中每个键可以有多个值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆