I am using Firebase for Unity to store some Users with a score. Firebase returns my list of Users as a IDictionary<string, object>
where the Key
is some id generated by Firebase and the Value
is another IDictionary<string, object>
that represents the User.
The User has a Key
called "score" and I want to sort all the Users by the Value
of the score for a Leaderboard.
This more or less what the data would look like as JSON:
"users": {
"<userid>" : {
"name" : "John",
"score": 5
...
},
"<userid>" : {
"name" : "Pete",
"score" : 10
}
...
}
How would I go about sorting the list of users? I assume that I would need to use Linq in some way, but I am still struggling to grasp how it works.
Some help would really be appreciated. Thanks!