I need to create a list of rows that represent the first five of the summed values.
I have a database with hundreds of accounts related to different services.
ex. electricity $ 600 January 2013 Water $ 50 January 2013
I need to summarize all the same services that I did here
public List<Double> GetSumOfSingleServices { get { var sums = (from dc in GetDashboardData group dc by dc.serviceType into g select g.Sum(sc => sc.serviceCost)).ToList(); return sums; } set { NotifyPropertyChanged("GetSumOfSingleServices"); } }
I created a list of lines with the following code
public List<String> GetServiceNames { get { var names = (from dc in GetDashboardData group dc by dc.serviceType into g select g.First().serviceType).ToList(); return names; } set { NotifyPropertyChanged("GetServiceNames"); } }
Now the data in these two lists is parallel to GetSumOfSingleServices [0] - this is the value for GetServiceNames [0], etc.
I would like to have a list in which Strings are ranked by the highest value from GetSumOfSingleServices, etc.
So, if the highest GetSumOfSingleServices [3] and its parallel line is GetServiceNames [3], then I would like GetServiceNames [3] to be my first entry in the list.
Not sure how to sort a list of strings by double values.
it
source share