value = (LevelEnum)Enum.Parse(typeof(LevelEnum),"CDD");
So, you simply parse the string corresponding to the value of the enumeration that you want to assign to the variable. This will happen if the string is not a specific member of the enumeration. you can check it withEnum.IsDefined(typeof(LevelEnum),input);
source
share