diamond diamond

diamond diamond

  • NA
  • 133
  • 55.4k

how to add a null list to list of list ?

Aug 25 2013 8:58 AM
Hi all,

I have a list its name is TP that may be a null or has data, and have a list of list vairable its name is history.
I want to add the TP list to history with help of a counter "winc".

int winc = 1;
 List<string > TP ;
        List <List<string> > history = new List <List<string>>()  ;


When I run the code below gives exception invalid index or arument "An ArgumentOutOfRangeException"
 history[winc-1].AddRange (TP.ToList ());
 winc++;

I slould say in first time my TP list is null and TP.count() is 0.
Please help 
Thanks

Answers (4)