0

私はEF にいくつかの (s)を持つクラスを持っRoomています。EF から取得したof を持っています。このコードを使用して、 of s ( )内のすべての s に到達します。BedRoomBedCollectionRoomcontextBedCollectionRoommyRooms

IEnumerable<Room> myRooms=...
IEnumerable<Bed> bedsInMyRoom=context.Beds.AsEnumerable();
foreach (IEnumerable<Bed> beds in myRooms.Beds)
     {
       if(beds!=null && beds.Any())
          bedsInMyRoom=bedsInMyRoom.Concat(beds);
     }

これを行うためのパフォーマンスの良い方法はありますか?

4

1 に答える 1