Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
class Program
static void Main(string[] args)
List<Player> foo = new List<Player>
new Player(100, "Miku"),
new Player(350, "Ren"),
new Player(700, "Yukarin"),
new Player(3500, "IA")
var sortedByHp = foo.OrderBy(e => e.hp); //sort hp
var sortedByName = foo.OrderBy(e =>; //sort name
sortedByHp.ToList().ForEach(x => Console.WriteLine(x.hp)); //show
sortedByName.ToList().ForEach(x => Console.WriteLine(; //show
class Player
public int hp;
public string name;
public Player(int hp, string name)
this.hp = hp; = name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.