-
-
Notifications
You must be signed in to change notification settings - Fork 94
Closed
Description
Simplified example:
using static System.Linq.Expressions.Expression;
public static class Test
{
public delegate void Handler(int? value);
public static Handler Create()
{
var parameterExpr = Parameter(typeof(int?), "value");
var toStringMethod = typeof(int?).GetMethod(nameof(object.ToString));
var callExpr = Call(parameterExpr, toStringMethod);
var callIfNotNull = IfThen(Not(Equal(parameterExpr, Constant(null, typeof(int?)))), callExpr);
return Lambda<Handler>(callIfNotNull, parameterExpr).CompileFast();
}
}For 5a3d4ba:

Didn't try to understand it, but looks overly complex (and failing while executing).

