I have a list of custom type. And the custom type is
public class PossibleMatch
{
public PossibleMatch()
{
StoreIds = new List<long>();
OrderLineIds = new List<long>();
}
public IList<long> StoreIds { get; set; }
public IList<long> OrderLineIds { get; set; }
}
I have to sort the list in such a way item with less number of stores and more number of order lines should be at top.
Thanks in advance.
LINQ has just the methods for this.
Try the following to order by matches with the fewest StoreIds first and then to sub order by matches with the most OrderLineIds:
Or to order by matches with the most OrderLineIds first and then to sub order by matches with the fewest StoreIds: