内容简介:我需要类似于List<String,Int32,Int32>的东西. List一次只支持一种类型,而Dictionary一次只支持两种类型.是否有一种干净的方式来做上面的事情(一个多维通用列表/集合)?翻译自:https://stackoverflow.com/questions/2994811/is-there-something-like-liststring-int32-int32-multidimensional-generic-lis
我需要类似于List<String,Int32,Int32>的东西. List一次只支持一种类型,而Dictionary一次只支持两种类型.是否有一种干净的方式来做上面的事情(一个多维通用列表/集合)?
最好的方法是为它创建一个容器,即一个类
public class Container
{
public int int1 { get; set; }
public int int2 { get; set; }
public string string1 { get; set; }
}
然后在你需要它的代码中
List<Container> myContainer = new List<Container>();
翻译自:https://stackoverflow.com/questions/2994811/is-there-something-like-liststring-int32-int32-multidimensional-generic-lis
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Dive Into Python
Mark Pilgrim / Apress / 2004-11-5 / GBP 31.49
Python is a new and innovative scripting language. It is set to replace Perl as the programming language of choice for shell scripters, and for serious application developers who want a feature-rich, ......一起来看看 《Dive Into Python》 这本书的介绍吧!