简体   繁体   English

请在C#.net中提供嵌套列表的示例

[英]Please provide example of Nested list in C#.net

How can i add list to another list, eg: 如何将列表添加到另一个列表,例如:

List<string> list = new List<string>();

I want to add this list to another list, something like: 我想将此列表添加到另一个列表中,例如:

List<List> list2 = new List<List>()
var list1 = new List<string>();
var list2 = new List<string>();
var parentList = new List<List<string>> {list1, list2};

Create nested classes, and in each class a property of type List(Of xxSubClassxx) 创建嵌套类,并在每个类中创建List(Of xxSubClassxx)类型的属性

a vb example would be: 一个vb的例子是:

class list1

 property list as new List(of xfirstlist)

 class xfirstlist

   property list2 as new list(of xSecondList)
   class xSecondList

   end class

 end class

end class

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM