c# - How to sort list of class object -
i have list of model class object. class scoreboard have total score 1 property.
scoreboard scoreboard = new scoreboard();
i sorting list
data= data.orderbydescending(x => x.totalscore).tolist()
but wont work. please should list of object of class.
if understood sorting issue correctly, might
list<class1> scores = new list<class1>(); scores.add(new class1 { score = 1, totalscore = 2, user = "a" }); scores.add(new class1 { score = 1, totalscore = 5, user = "b" }); scores.add(new class1 { score = 1, totalscore = 3, user = "c" }); scores = scores.orderbydescending(x => x.totalscore).tolist();
this sort total score.
Comments
Post a Comment