i am beginer and i don't know how to write from text file to list some strings. I mean i have a file :
A B
C D
E F
G H
...
and i want to write it to list but i dont know how, maybe it is simple but i tried something and it doesnt work. Now i have
List<List<string>> listaKolumn = new List<List<string>>();
var str = Application.GetResourceStream(new Uri("wzor.txt", UriKind.Relative));
StreamReader sreader = new StreamReader(str.Stream);
int x = 0;
while (!sreader.EndOfStream)
{
foreach (string k in sreader.ReadToEnd().Split(new char[] { ' ' }))
{
int j = 0;
foreach (string l in k.Split(new char[] {' '}))
{
if (listaKolumn.Count < k.Split(new char[] { ' '}).Length)
{
listaKolumn.Add(new List<string>());
}
//double temp2;
listaKolumn[j].Add(l);
j++;
}
}
}
but something is wrong. i know how it should be only in mind but i dontn know language very well and i can't write it.
IN SHORT i need this text wite in to multidimensional array like array[0][0] = A array[0][1]=B array[1][0] =C array[1][1] = D and so on