I have the following classes.
public class PriceDetails
{
public float AverageNightlyRate { get; set; }
}
public class RoomContainer
{
public PriceDetails RoomPriceDetails { get; set; }
public string PromotionDescription { get; set; }
}
public List<RoomContainer> HotelRooms { get; set; }
The list HotelRooms has 10 items.
I want to find the maximum value of AverageNightlyRate.
I am using for loop to iterate .
Can I do it in an efficient manner ?
Use Enumerable.Max:
If
RoomPriceDetailscould benull, then:Or