我想調用一個方法,該方法需要基於之前選擇的參數的一些參數。基於其他參數的必需參數
這可能是更好的用一個例子解釋:
public static void MyMethod (string p1, string p2, string p3 = "", string p4 = "")
{
}
我想實現的是需要p4
如果p3
給出。
如果我這樣稱呼它:
MyMethod("Hello", "World", "P3", // p4 now required as p3 given a value)
我希望這是有道理的。謝謝。
謝謝,這幫助我做我所需要的。 +1 – 2012-03-27 11:20:24