0
我在阅读文件时遇到问题。保存仅结束行
我必须编写程序,从波兰彩票的数字(保存在.txt),并将其添加到列表并回答问题。
反正..我的算法仅保存端线。我要保存所有的行列表.. :)
string line;
List<Losuj> losowanko = new List<Losuj>();
Losuj pomocnik = new Losuj();
StreamReader file =
new StreamReader(@"D:\bawmy się\2# apka\Lotto\Lotto\plik.txt");
while ((line = file.ReadLine()) != null)
{
// Console.WriteLine(line);
string[] podzialka = line.Split(new string[] { ".", " ", "," }, StringSplitOptions.None);
pomocnik.NumerLosowania = Int32.Parse(podzialka[0]);
pomocnik.JakiDzien = Int32.Parse(podzialka[2]);
pomocnik.JakiMiesiac =Int32.Parse(podzialka[3]);
pomocnik.JakiRok=Int32.Parse(podzialka[4]);
for (int i = 5, lo=0; i < 11; i++,lo++)
{
pomocnik.Los[lo] =Int32.Parse(podzialka[i]);
}
losowanko.Add(pomocnik);
}
file.Close();