Table of strings in C# -


is there way of creating table each cell containing string in c# ?

the closest thing found multidimensional arrays string[,] names;, seems length needs defined problem me.

here code looks :

string[] namepost; int[] numbpage; string post=""; string newpost; int i=0; int j=0;  foreach (var line in file.readlines(path).where(line => regex1.match(line).success))             {                 newpost = regex1.match(line).groups[1].value;                 if (string.compare(newpost, post) == 0)                 {                     j = j + 1;                 }                 else                 {                     namepost[i] = post;                     numbpage[i] = j;                     post = newpost;                     j = 1;                     = + 1;                 }                 } 

each instance of for writes name of new "post" in cell of namepost. in end, namepost table stores name of posts different 1 another.

what best way achieve ?

if trying store posts, can use list class system.collections.generic namespace:

using system.collections.generic; list<string> namepost = new list<string>(); 

then, instead of namepost[i] = post;, use

namepost.add(post); 

Comments