C# Method Using Params Keyword

c#, parameters

Solution

public static void MyMethod(params Foo[] values) { }

Problem

An example of a method that uses the params keyword is `String.Format("", foo, bar, baz)` But how would I make a method that accepts an array of enums like so: ``` 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); } } ```

Original source