List sorting C# using 2 fields -
i have list of custom objects. object contains 1 string , 2 decimals. sort list based on 2nd decimal field descending first decimal field.
for eg:
object 1 -> "a", 100, 10 object 2 -> "b", 300, 0 object 3 -> "c", 200, 200 object 4 -> "b", 400, 0
would sorted object 3, object 1, object 4, object 2
i apologize if has been answered - please point me post not find it
list.orderbydescending(o => o.field2) .thenbydescending(o => o.field1);
Comments
Post a Comment