Answers for "how to pass enum value to function in c#"

C#
0

how to pass string value to enum in c#

MyEnum myEnum = (MyEnum)Enum.Parse(typeof(MyEnum), myString);
Posted by: Guest on December-11-2020
0

enum in method as argument c#

public static void MyEnumMethod(Enum e)
    {
        var enumValues = Enum.GetValues(e.GetType());
        // you can iterate over enumValues with foreach
    }

MyEnumMethod(new MyEnum());
Posted by: Guest on October-18-2020

Code answers related to "how to pass enum value to function in c#"

C# Answers by Framework

Browse Popular Code Answers by Language