public static List <Covid19> GetDatas() { var filename = @"C:\Users\User\Desktop\jiyeyu_21W\COMP212\Midterm\Midterm\covid19_confirmed_global.csv"; var lines = File.ReadAllLines(filename); List <Covid19> covidList2 = new List <Covid19>(); for (int i = 1; i < lines.Length; i++) { string[] line = lines[i].Split(','); var covid = new Covid19() { State = line[0], Country = line[1] }; if (line[i] != line[i - 1]) { covidList2.Add(covid); } } return(covidList2.OrderBy(a => a.Country).ToList()); }
Covid19 StartCovidSearch(string name) { var result = new Covid19(); result.covid19List = CovSearch(name); return(result); }
public static List <Covid19> GetDatas() { var filename = @"C:\Users\User\Desktop\jiyeyu_21W\COMP212\Midterm\Midterm\covid19_confirmed_global.csv"; var lines = File.ReadAllLines(filename); List <Covid19> covid19List = new List <Covid19>(); int count = 2; for (int j = 0; j < 386; j++) { for (int i = 0; i < 1; i++) { string[] line2 = lines[i].Split(','); dateCheck = line2[count]; } for (int i = 1; i < lines.Length; i++) { string[] line = lines[i].Split(','); var covid = new Covid19() { Country = line[1], State = line[0], NumberofCase = Int32.Parse(line[count]), ConfirmedDate = dateCheck }; if (!covid.NumberofCase.Equals(0)) { covid19List.Add(covid); } } count++; } return(covid19List.OrderBy(a => a.Country).ToList()); }