I have a problem about some simple code in console. Precisely I created a public enum called Year which contains 4 seasons (obvious). I want the program to ask at the beginning what is the season of the year and then generate an answer to each option. The problem is I don't know how to convert my string input to each option of this enum. Maybe it will be more clear if i show you the code (it's short).
Console.WriteLine("What time of year is it?"); var input = Console.ReadLine(); //earlier it was just //time = Year.Winter; switch (time) { case Year.Autumn: Console.WriteLine("You're gonna have to grab the leaves"); break; case Year.Summer: Console.WriteLine("Let's go to the beach"); break; case Year.Winter: Console.WriteLine("Better to warm up at home"); break; case Year.Spring: Console.WriteLine("Best time of the year!"); break; default: Console.WriteLine("I don't know this time of year"); break; } I want to make something like this but dunno what to put inside this switch statement because I can't just put there my string 'input'. Is it possible in the way I am thinking of it?