public static void Run(string path) { TicketsCollection myTicketsList = new TicketsCollection(); using (StreamReader sr = new StreamReader(path)) { LuckyTicketType luckyTicketType = GetLuckyTicketType(sr.ReadLine().ToUpper()); string buffer = sr.ReadLine(); while (buffer != null) { int[] numbers = Validator.ValidateNumberAndReturnArray(buffer); myTicketsList.Add(new Ticket(numbers, luckyTicketType)); buffer = sr.ReadLine(); } UserIterface.Display(myTicketsList); } }
public static void Display(TicketsCollection tickets) { Console.WriteLine($"Count of lucky tickets: {tickets.CountOfLuckyTickets()}"); }