private void readFile() { Lottery.ClearLotterys();// 清空开奖记录 StreamReader sr = new StreamReader(Param.FilePath, Encoding.Default); String line; while ((line = sr.ReadLine()) != null) { if (string.IsNullOrEmpty(line)) { continue; } Lottery.AddLottery(line); } sr.Close(); }
private void readFile(Lottery lottery, string fileName) { lottery.ClearLotterys();// 清空开奖记录 using (StreamReader sr = new StreamReader(fileName, Encoding.Default)) { String line; while ((line = sr.ReadLine()) != null) { if (string.IsNullOrEmpty(line)) { continue; } lottery.AddLottery(this.dtp.Value, line); } sr.Close(); sr.Dispose(); } }