Eline Sami

Eline Sami

  • NA
  • 47
  • 70.2k

Saving array inside other array

Aug 5 2015 9:05 AM
Hi Vulupes
 
Hope I can find an answer to the below question:
 
I declared the following to add multiple arrays inside an array so that I can use those lists separately later in my application
.
private List<List<string>> groupOfLists = new List<List<string>>();


this works fine in the following code only if I am still working on the application: and let us say if I need to give a name of this group to show in a dgv for example:

 groupOfLists.Add(thisList);

int index = dataGridView1.Rows.Add(); 
var row = dataGridView1.Rows[index];

foreach (string List in thisList)
{
 row.Cells["Group_No"].Value = groupOfLists.count;

}


So, if I am still working on the application, the groupOfLists will be increased and the value of group_No filed will be changed every time.

Suppose I close the application and restart it once again, then the GroupOfLists.count will be set to zero. Hence, some fields will state same number of group! (which I don't want).

Is there a way to keep the saved lists inside the GroupLists even if the application is closed? Please help.


Answers (3)