Complete the code to parse the string "Red" into the Color enum.
Color color = (Color) Enum.Parse(typeof(Color), [1]);The Enum.Parse method requires the string name of the enum value, so it must be passed as a string literal like "Red".
Complete the code to safely parse the string "Blue" into the Color enum using TryParse.
bool success = Enum.TryParse<Color>([1], out Color color);The Enum.TryParse method requires the string to parse, so you must pass the string literal "Blue".
Fix the error in parsing the string "Green" to the Color enum using Enum.Parse.
Color color = (Color) Enum.Parse(typeof(Color), [1], true);The string must be passed with quotes and match the enum name case-insensitively because of the true ignoreCase parameter. So "Green" is correct.
Fill both blanks to parse "Yellow" ignoring case and assign to variable.
Color color = (Color) Enum.Parse(typeof(Color), [1], [2]);
false instead of true for ignoreCase.The first blank needs the string "Yellow" and the second blank the boolean true to ignore case.
Fill all three blanks to parse string to enum, check success, and print result.
if (Enum.TryParse<Color>([1], out Color [2])) { Console.WriteLine([3]); }
The string to parse is "Purple", the out variable is parsedColor, and we print parsedColor.