In F# it is not uncommon to declare infix operators for binary operators. But how are they represented if we try to use them in C# Since there are no way of declaring infix operators in C#?
Toy Example
let ( .|. ) a b = a + b
In F# it is not uncommon to declare infix operators for binary operators. But how are they represented if we try to use them in C# Since there are no way of declaring infix operators in C#?
Toy Example
let ( .|. ) a b = a + b
If you check the IL representation of your operator, you will see this:
Unfortunately you won't be able to refer to this from
C#
. However you can add an attribute:Then you can just reference your F# dll from C# and call it via
addop
:Console.WriteLine(global::Program.addop(1,2));