fork download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class ConfigOptions
  5. {
  6. public string Label { get; set; }
  7. public string Value { get; set; }
  8. }
  9.  
  10. public class Test
  11. {
  12. public static void Main()
  13. {
  14. var values = Enum.GetNames(typeof(VehicleData))
  15. .Cast<string>()
  16. //.Select(x => x.ToString())
  17. .Select(z => new ConfigOptions{ Label=z, Value=z })
  18. .ToArray();
  19. foreach(var val in values)
  20. Console.WriteLine(val.Label);
  21. }
  22. }
  23.  
  24. public enum VehicleData
  25. {
  26. Dodge = 15001,
  27. BMW = 15002,
  28. Toyota = 15003
  29. }
Success #stdin #stdout 0.03s 29644KB
stdin
Standard input is empty
stdout
Dodge
BMW
Toyota