Answers for "get number from enum"

C#
2

get enum int by name

int enumInt = (int) Enum.Parse(typeof(Your_Enum), string_name);
Posted by: Guest on February-12-2021
0

Get enum value from string or int

MyEnum myEnum = (MyEnum)myInt;

MyEnum myEnum = (MyEnum)Enum.Parse(typeof(MyEnum), myString);
Posted by: Guest on September-27-2021

C# Answers by Framework

Browse Popular Code Answers by Language