Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Linq minimal value of integer in object

$
0
0

Hi

I have class Device and it has Price. How do I get the minimal price from all devices? here is the Class

 public class Device
    {
        public int ProductID { get; set; }
        public string ProductTitle { get; set; }
        public int Price{get, set}
    }

now in the code I have

List<Device> Devices = LoadAllDevices(); //loads all devices from database, unnesesary to put the implementation

var minimumPrice=Devices.Select(x=>x.Price!=null && //HERE IS THE PROBLEM TO FIND MINIMUM PRICE OF ALL THE DEVICES);

Please advice how do i find the minimum?


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>