c# select distinct values from linq group by code example
Example: c# linq distinct group by nested list
var result = hotels.SelectMany(hotel => hotel.RoomType.Select(room => new { Id = room.RoomId, Hotel = hotel }))
.GroupBy(item => item.Id)
.Select(group => group.FirstOrDefault());