3
My code displays error when using Enum.Parse<enum>(Console.ReadLine());
I am asking the user to enter the level of the position occupied, however to receive the data entered by the user Parse<> displays error, does not pass to the Level
.
Classe program
static void Main(string[] args)
{
Console.WriteLine("Enter client data: ");
Console.Write("Name: ");
string clientName = Console.ReadLine();
Console.Write("Email: ");
string email = Console.ReadLine();
Console.Write("Birth date (DD/MM/YYYY): ");
DateTime birthDate = DateTime.Parse(Console.ReadLine());
Console.WriteLine("Enter order data: ");
Console.Write("Level: (Junior/MidLevel/Senior) ");
OrderStatus Level = Enum.Parse<OrderStatus>(Console.ReadLine());
}
classe Enums
enum OrderStatus : int
{
Junior = 0,
MidLevel = 1,
Senior = 2
}
CS0308 Error The non-generic "Enum.Parse(Type, string)" method cannot be used as Salesorde type arguments
CS0308 Error The non-generic "Enum.Parse(Type, string)" method cannot be used as Salesorder type arguments
– Thulio Mariano
Your code here doesn’t have
SalesOrder
. The code on Github has no enumeration.– Maniero
sorry, corrected
– Thulio Mariano
Enum is inside the Entitie
– Thulio Mariano