You can use the Enum.TryParse()
method to convert a string to the equivalent enumerated value (assuming it exists):
Name myName;
if (Enum.TryParse(nameString, out myName))
{
switch (myName) { case John: ... }
}
You can use the Enum.TryParse()
method to convert a string to the equivalent enumerated value (assuming it exists):
Name myName;
if (Enum.TryParse(nameString, out myName))
{
switch (myName) { case John: ... }
}