C# enums as function parameters?

后端 未结 7 1378
广开言路
广开言路 2021-01-04 00:10

Can you pass a standard c# enum as a parameter?

For example:

enum e1
{
    //...
}

enum e2
{
    //...
}

public void test()
{
    myFunc( e1 );
           


        
7条回答
  •  北海茫月
    2021-01-04 00:18

    Enum.GetValues Enum.GetNames

    so something like...

    foreach(e1 value in Enum.GetValues(typeof(e1)))
    

提交回复
热议问题