每个键具有多个值的列表 [英] List with multiple values per key

查看:67
本文介绍了每个键具有多个值的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何创建具有多个值的列表,例如,list [0]包含三个值{"12","String","someValue"}} Some值与我要使用的其他两个值相关联列出而不是使用数组

how do we create a list with multiple values for example , list[0] contains three values {"12","String","someValue"} the Some value is associated to the two other values i want to use a list rather than using an array

string[, ,] read = new string[3, 3, 3];

推荐答案

为什么没有ListTuple? 尚不清楚,但是它会做您想要做的事情:

Why not have a List of Tuple's? It can be unclear, but it will do what you are after:

var list = new List<Tuple<string, string, string>>();
list.Add(new Tuple<string, string, string>("12", "something", "something"));

尽管给这些值赋予语义可能会更好.也许,如果您让我们知道打算显示的值是什么,那么我们可以就如何使其更具可读性给出一些想法.

Although it would probably be better to give these values semantic meaning. Perhaps if you let us know what the values are intending to show, then we can give some ideas on how to make it much more readable.

这篇关于每个键具有多个值的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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