c# assign string to enumm code example
Example 1: string to enum c#
Enum.TryParse("Active", out StatusEnum myStatus);
Example 2: how to pass string value to enum in c#
MyEnum myEnum = (MyEnum)Enum.Parse(typeof(MyEnum), myString);
Enum.TryParse("Active", out StatusEnum myStatus);
MyEnum myEnum = (MyEnum)Enum.Parse(typeof(MyEnum), myString);