static bool CreateDatabase( string fileDB, out LottoListResults dbl) { dbl = new LottoListResults(); using (var reader = File.OpenText(fileDB)) { var line = string.Empty; while ((line = reader.ReadLine()) != null) { var values = line.Split(' ')[2].Split(','); var res = new LottoResult( int.Parse(values[0]), int.Parse(values[1]), int.Parse(values[2]), int.Parse(values[3]), int.Parse(values[4]), int.Parse(values[5]) ); dbl.Add(res); } } dbl.Reverse(); return(true); }
static bool CreateDatabase(List <LotteryModel> fileDB, out LottoListResults dbl) { dbl = new LottoListResults(); foreach (LotteryModel lotteryModel in fileDB) { var res = new LotteryResult( lotteryModel.Numbers[0], lotteryModel.Numbers[1], lotteryModel.Numbers[2], lotteryModel.Numbers[3], lotteryModel.Numbers[4] ); dbl.Add(res); } dbl.Reverse(); return(true); }
static bool CreateDatabase(string fileDB, out LottoListResults dbl) { dbl = new LottoListResults(); using (var reader = File.OpenText(fileDB)) { var line = string.Empty; while ((line = reader.ReadLine()) != null) { var values = line.Split(' ', '\t')[2].Split(','); var res = new LottoResult(values.Select(s => double.Parse(s)).ToArray()); dbl.Add(res); } } dbl.Reverse(); return(true); }