private static void Beolvas() { footg = new List <footgolf>(); StreamReader sr = new StreamReader(@"fob2016.txt", Encoding.UTF8); while (!sr.EndOfStream) { string[] line = sr.ReadLine().Split(';'); footgolf ft = new footgolf(); ft.nev = line[0]; ft.kategoria = line[1]; ft.egyesulet = line[2]; ft.pontok = new List <int>(); for (int i = 3; i < line.Length; i++) { ft.pontok.Add(Convert.ToInt32(line[i])); } footg.Add(ft); } sr.Close(); }
static void Beolvas() { StreamReader sr = null; string fajl = @"fob2016.txt"; using (sr = new StreamReader(fajl, Encoding.UTF8)) { while (!sr.EndOfStream) { string[] sorok = sr.ReadLine().Split(';'); List <int> pontok = new List <int>(); for (int i = 3; i < sorok.Length; i++) { pontok.Add(Convert.ToInt32(sorok[i])); } footgolf temp = new footgolf(sorok[0], sorok[1], sorok[2], pontok, 0); minden.Add(temp); } } }