static void Main(string[] args) { string path = @"C:\Users\NDM\Downloads\country.csv"; int count = 1; CsvReader csvReader = new CsvReader(path); Console.Write("Input number row:"); string inputnumber = Console.ReadLine(); int number = ValidatedData.CheckNumberMaxMinInt(inputnumber); foreach (Country item in csvReader.ReadFirstNCountries(10)) { if (count++ % number == 0) { Console.Write("Press any key next page"); Console.ReadKey(); } if (item != null) { Console.WriteLine(item.Name.PadRight(40, ' ') + item.Population); } } Console.ReadKey(); }
public void InsertStudent() { studentMark = new StudentMark(); Console.Write("Please input FullName: "); studentMark.FullName = Console.ReadLine(); Console.Write("Please input Class: "); studentMark.Class = Console.ReadLine(); Console.Write("Please input Semester: "); string semester = Console.ReadLine(); studentMark.Semester = ValidatedData.CheckNumberInt(semester); Console.Write("Please input marks1 of subject: "); string mark1 = Console.ReadLine(); studentMark[0] = ValidatedData.CheckNumberMaxMinInt(mark1); Console.Write("Please input marks2 of subject: "); string mark2 = Console.ReadLine(); studentMark[1] = ValidatedData.CheckNumberMaxMinInt(mark2); Console.Write("Please input marks3 of subject: "); string mark3 = Console.ReadLine(); studentMark[2] = ValidatedData.CheckNumberMaxMinInt(mark3); Console.Write("Please input marks4 of subject: "); string mark4 = Console.ReadLine(); studentMark[3] = ValidatedData.CheckNumberMaxMinInt(mark4); Console.Write("Please input marks5 of subject: "); string mark5 = Console.ReadLine(); studentMark[4] = ValidatedData.CheckNumberMaxMinInt(mark5); hashtable.Add(studentMark.ID, studentMark); }