fork download
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public class Meibo
  6. {
  7. public int Id { get; set; }
  8. public string Name { get; set; }
  9. public int Age { get; set; }
  10. }
  11.  
  12. static void Main(string[] args)
  13. {
  14. var meibo = new Meibo[]{
  15. new Meibo{Age = 10},
  16. new Meibo{Age = 50},
  17. new Meibo{Age = 30}
  18. };
  19.  
  20. Array.Sort(meibo, (x, y) => y.Age - x.Age);
  21.  
  22. // 結果表示
  23. foreach (var item in meibo)
  24. {
  25. Console.WriteLine(item.Age);
  26. }
  27. }
  28. }
Success #stdin #stdout 0.01s 37984KB
stdin
Standard input is empty
stdout
50
30
10