fork download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. var userRoles = new []
  9. {
  10. RoleType.Guest,
  11. RoleType.Admin,
  12. RoleType.User
  13. };
  14.  
  15. var highestRole = userRoles.Max();
  16.  
  17. Console.WriteLine("The type is: " + highestRole.GetType().Name);
  18. Console.WriteLine("The values is: {0}({1})",
  19. (int)highestRole,
  20. highestRole);
  21. }
  22. }
  23.  
  24. public enum RoleType
  25. {
  26. Default = 10,
  27. Guest = 20,
  28. User = 30,
  29. Admin = 40,
  30. Super = 50
  31. }
Success #stdin #stdout 0.04s 37096KB
stdin
Standard input is empty
stdout
The type is: RoleType
The values is: 40(Admin)