2
如何實現具有可變數量參數的方法?如何實現具有可變數量參數的方法?
In C#, we can use the params keyword:
public class MyClass
{
public static void UseParams(params int[] list)
{
for (int i = 0; i < list.Length; i++)
{
Console.Write(list[i] + " ");
}
Console.WriteLine();
}
}
所以,我該怎麼辦這在F#?
type MyClass() =
member this.SomeMethod(params (args:string array)) =()
我收到以下錯誤從上面的代碼:
The pattern discriminator 'params' is not defined
[在F#中的可能的複製,你如何咖喱ParamArray函數(li ke sprintf)?](http://stackoverflow.com/questions/11145680/in-f-how-do-you-curry-paramarray-functions-like-sprintf) –