turt2live

Untitled

Sep 23rd, 2013
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.22 KB | None | 0 0
  1. string input = Console.ReadLine();
  2. int number = 0;
  3. if(int.TryParse(input, out number)){
  4.     // Assuming your enum is called "Planet"
  5.     Planet planet = (Planet)number;
  6.     switch(planet){
  7.     case Planet.Earth:
  8.     // etc...
  9.     }
  10. }
Advertisement
Add Comment
Please, Sign In to add comment