public override void CsvToList() { StreamReader sr = new StreamReader(File); while (!sr.EndOfStream) { string showLine = sr.ReadLine(); ListToDisplay.Add(showLine); } sr.Close(); }
public override void CsvToList() { while (true) { Console.WriteLine("\nHow many movies would you like to display?"); string userInput = Console.ReadLine(); int userInputNumber; if (int.TryParse(userInput, out userInputNumber)) { StreamReader sr = new StreamReader(File); for (int i = 0; i < userInputNumber; i++) { string movieLine = sr.ReadLine(); ListToDisplay.Add(movieLine); } sr.Close(); break; } Console.WriteLine("Please enter a number"); } }