How can I declare interface member with two arguments? Something like:
type IService =
abstract myMember: (a:int) (b:string) -> result
For a function with two arguments:
type IService =
abstract member myMember: int -> string -> string
Alternatively, you could use a tuple:
type IService =
abstract member myMember: int * string -> string
The reason the syntax is int -> string -> string (where an arrow denotes the return of a function) is because functions with multiple parameters in F# can be partially applied by default.
It's also important to note that if you're writing a library that you intend to consume from other .net languages, you should use the tuple form.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With