Update Lesson 2 Task 4

This commit is contained in:
Stanislav Mykhailenko 2023-03-19 14:23:47 +02:00
parent e6da7ff461
commit c7cb2e8fd9
GPG key ID: 1E95E66A9C9D6A36

View file

@ -20,11 +20,13 @@ List<Car> cars = new List<Car>()
string? number;
do
while (true)
{
Console.Write("Enter number: ");
number = Console.ReadLine();
} while (number == null);
if (number != null)
break;
}
var selected = owners.FirstOrDefault(owner => cars.Any(car => car.Number == number && car.OwnerId == owner.Id));
@ -54,11 +56,6 @@ class Car
public string Number { get;}
public int OwnerId { get;}
public override string ToString()
{
return "Number: " + Number + ", Owner ID: " + OwnerId;
}
public Car(string number, int ownerId)
{
Number = number;