SHARE
TWEET

Untitled

nassss Feb 24th, 2020 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         public static Priority ParseEnumPriority(string input)
  2.         {
  3.             while (true)
  4.             {
  5.                 input = Console.ReadLine();
  6.                 var success = Enum.TryParse(input, true, out Priority parsedEnum);
  7.  
  8.                 if ((!Enum.IsDefined(typeof(Priority), parsedEnum)) || string.IsNullOrEmpty(input) || string.IsNullOrWhiteSpace(input) || (!success))
  9.                 {
  10.                     Console.WriteLine("Please enter a valid input that is between options above!");
  11.                     continue;
  12.                 }
  13.                 return parsedEnum;
  14.             }
  15.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top