Given a statement block, wrap it in a lambda assigned to an Action variable, and execute it immediately.
Loading Gist 21a92bc8770caf19bf24812dff938822...
I believe this is a refactoring: I believe that this transformation has no effect on the behavior of the code. But I'm not completely certain.
I think a similar recipe for expressions is equally valid, using a
Func<>
instead of Action
.This is almost the same operation as Extract Method.
No comments:
Post a Comment