F#转发可选参数

时间:2016-03-12 13:47:57

标签: f#

是否可以转发可选参数,例如:

type Type() =
    member this.A(?param) = printfn "%d" <| defaultArg param 0
    member this.B(?param) = this.A(param)  // how to do this ?

1 个答案:

答案 0 :(得分:4)

像这样:

    member this.B(?param) = this.A(?param = param)

在提供命名的可选参数时使用?可以传递选项。