Sahil Dev

Sahil Dev

  • NA
  • 77
  • 6.8k

Creating array of lists and combining

Jul 28 2016 12:58 PM

 I want to do the following:

 

1)Create an array of 100 lists
 
So, I have:
 
  1. List<int>[] a = new List<int>[100];  
2)Next I do,
 
  1. for(j=0; j<100;j++)  
  2. {  
  3.   
  4. a[j] = new List<int>();  
  5.   
  6.   
  7. }  
3) Next I add elements to each;
 
  1. a[j].Add(3);  
  2.   
  3. //and so on  
4) Now I want to combine all the lists into a single list
 
I do not know how to do that
 
Please note that I cannot create a single list due to some algorithmic constarints.
 
Can anyone advise? 
 
 
 
 
 

Answers (2)