enum DaysOfWeek { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday } DaysOfWeek today = DaysOfWeek.Tuesday; Type type = today.GetType(); Console.WriteLine($"The type of the enumeration is: {type}");
enum MonthsOfYear { January, February, March, April, May, June, July, August, September, October, November, December } string month = "july"; MonthsOfYear result; if (Enum.TryParseOutput: The type of the enumeration is: MonthsOfYear Package library: The System.Enum.GetType method is part of the System.Runtime.CompilerServices package.(month, out result)) { Type type = result.GetType(); Console.WriteLine($"The type of the enumeration is: {type}"); } else { Console.WriteLine("Invalid input."); }