I have defined the following interface in F#
[<ServiceContract>]
type ICarRentalService =
[<OperationContract>]
abstract member CalculatePrice: pickupDate:DateTime -> returnDate:DateTime -> pickupLocation:string -> vehiclePreference:string -> float
then I tried to implement it like this:
type CarRentalService() =
interface ICarRentalService with
override this.CalculatePrice(pickupDate:DateTime, returnDate:DateTime, pickupLocation:string, vehiclePreference:string) =
5.5
When compiling I get the following compile error:
This override takes a different number of arguments to the corresponding abstract member
I’m now looking at the thing and fiddling around for an hour, what do I do wrong?
Method in your interface is declared in curried form and your implementation is tupled:
if briefly: method in interface is function that accepts one argument and returns another function with remaining arguments. In opposite implementation accepts all arguments in one piece (packed in tuple)
To fix the code you need either to make implementation curried or declaration – tupled. Curried version will not work with WCF so consider using tupled version