How do you pass multiple enum values in C#?

后端 未结 10 1904
灰色年华
灰色年华 2020-11-29 16:50

Sometimes when reading others\' C# code I see a method that will accept multiple enum values in a single parameter. I always thought it was kind of neat, but never looked in

10条回答
  •  醉酒成梦
    2020-11-29 16:54

    Something of this nature should show what you are looking for:

    [Flags]
    public enum SomeName
    {
        Name1,
        Name2
    }
    
    public class SomeClass()
    {
        public void SomeMethod(SomeName enumInput)
        {
            ...
        }
    }
    

提交回复
热议问题