Hi All.

In continue to the previous email, I saw the following piece of code:
var ids = new List<int>{1,2,3,4,5};
var sum = 0;
ids.ForEach(i => sum += i);

That's clearly a closure. but I understood that C# doesn't have closures?
Or maybe "sum" in only valid while in-scope. (one-way closure?) So you 
shouldn't do something like:
Func<int, int> GetSummer(...) {
    var sum = 0;
    return i => sum + i;
}

can you?

Shmuel.
_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl

Reply via email to