How to sort this?
I have a list of strings with values like this
11-03-2013
11-03-2013 -Count=2
11-03-2013 -count=1
11-04-2013 -Count=1
11-04-2013 -Count=2
11-04-2013
The conclusion should be: the one that does not have an account should be the last, and the top one, then 1, and the dates should be sorted in ascending order.
11-03-2013 -Count=2
11-03-2013 -count=1
11-03-2013
11-04-2013 -Count=2
11-04-2013 -Count=1
11-04-2013
I tried this code, but this is sorting in descending order
var edates= edates.OrderBy(e => e.Replace("-count=1", string.Empty).Replace("-count=2", string.Empty)).ToList();
I know that a simple class with properties can do the trick, but for this you will need to change other methods that will require a lot of work.
Hello
source
share