如何在C#中获得特定运算符的功能?

Sil*_*viu 2 c# f# function operator-overloading

是否有可能获得C#运算符背后的功能?例如在F#中你可以做到

let add = (+);;

val add : (int -> int -> int)
Run Code Online (Sandbox Code Playgroud)

是否可以在c#中执行以下操作:

Func<int, int, int> add = (+);
Run Code Online (Sandbox Code Playgroud)

要么

Func<int, int, int> add = Int32.(+)
Run Code Online (Sandbox Code Playgroud)

And*_*zub 5

您可以使用lambda表达式:

Func<int, int, int> func = (val1, val2) => val1 + val2;
Run Code Online (Sandbox Code Playgroud)