using System.Collections.Generic;
public static void Main()
var list = new List<Contact>
new Phone { Name = "Pavlo", Number = 1234 },
new Email { Name = "Pavlo", Value = "1234@gmail.com" },
new Phone { Name = "Mary", Number = 5678 },
new Email { Name = "Mary", Value = "5678@gmail.com" }
list.GroupBy(x => x.Name)
Phone = x.OfType<Phone>().FirstOrDefault()?.Number ?? 0,
Email = x.OfType<Email>().FirstOrDefault()?.Value ?? string.Empty
.ForEach(x => Console.WriteLine($"{x.Name} {x.Phone} {x.Email}"));
public string Name { get; set; }
public int Number { get; set; }
public string Value { get; set; }