score:2

Remove the parameter from your method and make the expression accept two parameters:

public static Expression<Func<MyModel, DateTime, bool>> IsDateOf 
    = (MyModel p, DateTime d) => p.StartedAt.AddSeconds(p.UtcOffset) == d.Date;

Note I have made it a static field, not a method. Then in your LINQ expression, you need to invoke it:

MyModel.IsDateOf(result.entry, result.rec.DayOf)

If you don't make it a field (or property), you have to first invoke the method to get the expression; then you need to invoke the expression:

MyModel.IsDateOf()(result.entry, result.rec.DayOf)

Which, in my opinion, looks weird.


Related Query

More Query from same tag