Update Lesson 2 Task 3

This commit is contained in:
Stanislav Mykhailenko 2023-03-19 13:12:21 +02:00
parent b8010176e1
commit 31801ad9ce
GPG key ID: 1E95E66A9C9D6A36

View file

@ -26,14 +26,14 @@ do
name = Console.ReadLine(); name = Console.ReadLine();
} while (name == null); } while (name == null);
var selected = from s in customers where s.Name == name select s; var selected = from customer in customers where customer.Name == name select customer;
foreach (Customer customer in selected) foreach (Customer customer in selected)
{ {
Console.WriteLine(customer); Console.WriteLine(customer);
} }
var number = selected.Where(s => s.Age >= 18).Count(); var number = selected.Where(customer => customer.Age >= 18).Count();
Console.WriteLine("Amount of customers older than 18: " + number); Console.WriteLine("Amount of customers older than 18: " + number);