Hi friends,
I have one Hotel class that contains many properties.
When I retrieve all hotels data from database, I store them in Generic
List object.
Now what I want that I have two properties called
LowestPrice and HiestPrice. I want to get Minimum(LowestPrice) and
Maximum(HiestPrice) from generic list directly.
Something like HotelList.Min();
Right now I have following logic implemented in my project, but I dont want to use foreach loop.
HotelController h1 = null;
HotelController h2 = null;
foreach (HotelController h in hList)
{
if (h1 == null && h2 == null)
{
h1 = h;
h2 = h;
continue;
}
if (h.CheapestRate < h1.CheapestRate)
...
Go to the complete details ...