In F# i have the function:
module ModuleName
let X (y: int -> unit) = ()
How can i call this in C#? Ideally it would look like
ModuleName.X(x => x*x);
But this lambda syntax does not convert implicitly to a FSharpFunc.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The easiest approach would be to expose your API using standard .NET delegate types. In this case, that means that your F# definition should look more like:
However, if you want to keep your F# API the same as it currently is, then you could use
FuncConvert.ToFSharpFuncfrom the C# side: