c# linq distinct group by nested list 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());