Combining list of list as a single list

  1. List<int>[] a = new List<int>[10];  
  2. for (int i = 0; i <10; i++)  
  3. {  
  4.     a[i] = new List<int>();  
  5.     for (int ji = 0; ji < 5; ji++)  
  6.     {  
  7.         a[i].Add(ji * i); // adding some random int values to each list.  
  8.   
  9.     }  
  10. }  
  11. List<int> x = a.SelectMany(i => i.Select(j => j)).ToList();  
a is a list of list of integers and by nested for loops I am creating list of list of integers. And whenever we required, by doing selectmany (Lambda), we can combine the list together.