An example of a method using the params keyword is String.Format("", foo, bar, baz)
But how can I make a method that accepts an array of enums, for example:
class MyClass
{
public enum Foo { Bar, Baz }
public static void MyMethod(params enum[] Foo) {}
public static void TestMethod()
{
MyMethod();
MyMethod(Foo.Bar);
MyMethod(Foo.Baz);
MyMethod(Foo.Bar, Foo.Baz);
}
}
source
share