public static int EnumChoiseToInt(Type i_EnumType, string i_msg) { string userInput; string msg; int userChoise; int minChoise = 1; int maxChoise; UserConsole.SleepAndClear(); UserConsole.Print(i_msg); UserConsole.Print(UserConsole.EnumToString(i_EnumType)); userInput = UserConsole.Read(); userChoise = parseInt(userInput); maxChoise = Enum.GetNames(i_EnumType).Length; if ((userChoise < minChoise) || (userChoise > maxChoise)) { throw new ValueOutOfRangeException((float)minChoise, (float)maxChoise); } msg = string.Format(@"You choose {0}", userChoise); UserConsole.Print(msg); return(userChoise); }