3 ms·
It is correct to say that replacing the func with delegate and adding the semicolon makes it valid C# syntax. The correctness of that statement is completely in
by barrkel 16y ago
It is correct to say that replacing the func with delegate and adding the semicolon makes it valid C# syntax. The correctness of that statement is completely independent of C# lambdas, which are neither a complete subset nor a complete superset of C# anonymous delegates.
And it is ugly. It's ugly because the argument list visually expands across more than one line, including whole statements. The "redundant" forms of "using" and "lock" are both more limited than the closure-passing approach, but their limitations haven't been pressing enough to overcome much of tthe ugliness of the closure-as-parameter approach for this specific case of passing a statement block.