We can use “GetValues()” method of the “ENUM” class which returns an array of enum values.
var x = Enum.GetValues(typeof(MyColors));
What is the use of “ENUM.Parse” method?
“ENUM.Parse” parses string to an ENUM value. Like in the below code we pass “Green” string value and it gets type casted to enum which has green enum as a constant.
MyColors EnumColors = (MyColors)Enum.Parse(typeof(MyColors), “Green”);