使用該params關鍵字是String.Format("", foo, bar, baz)
C#方法,使用params關鍵字
但如何會使接受枚舉的,像這樣的陣列的方法的方法的一個例子:
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);
}
}
完美,謝謝! – RyanScottLewis 2010-02-24 18:40:39