You can convert the userType parameter to enum using this function:
object Enum.Parse(System.Type enumType, string value, bool ignoreCase);
as
UserType utEnum = Enum.Parse(UserType, userType, true);
and then you can invoke the switch statement as:
switch (utEnum)
{ ... }
source
share