Reading a blog from Brad Abrams about Avoiding Custom Delegates explaining
Expression<…> represents function definitions that can be compiled and subsequently invoked at runtime but can also be serialized and passed to remote processes. Continuing with our example:
Expression<Func<int, int, double>> expression = (x, y) => (double)x / (double)y;
Func<int, int, double> divide = expression.Compile();
Console.WriteLine(divide(2, 3));
No comments:
Post a Comment