Answers for "c# linq distinct group by nested list"

C#
0

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());
Posted by: Guest on February-22-2021

C# Answers by Framework

Browse Popular Code Answers by Language