如何在另一个列表中创建一个列表? [英] How to create a list inside the another list?

查看:56
本文介绍了如何在另一个列表中创建一个列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在另一个列表中创建一个列表.我怎样才能做到这一点?

I would like to create a list inside another list. How can I do this?

我如何从另一个列表中的列表中检索值?

And how do I retrieve values from the list which is inside another list?

推荐答案

我不确定我是否正确理解了您的问题.你想要这样的东西吗?

I'm not sure if I correctly understand your question. Do you want something like this?

var listOfList = new List<List<int>>(); 
listOfList.Add(new List<int>());
listOfList[0].Add(42);

这篇关于如何在另一个列表中创建一个列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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