fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. // your code goes here
  8. string ItemString = "Stone";
  9. Item enumItem;
  10. Item.TryParse(ItemString, out enumItem);
  11. int foo = (int)enumItem;
  12. Console.WriteLine(foo);
  13. }
  14. }
  15.  
  16. public enum Item
  17. {
  18. Wood,
  19. Stone
  20. }
Success #stdin #stdout 0.02s 16380KB
stdin
Standard input is empty
stdout
1