This post will discuss how to create a List of Lists in C#.

A simple solution for constucting a List of Lists is to create the individual lists and use the List<T>.Add(T) method to add them to the main list. The following example demonstrates its usage.

Download  Run Code

Output:

C, C++
Java, C#

 
This is equivalent to:

Download  Run Code

Output:

C, C++
Java, C#

That’s all about creating a List of Lists in C#.