Closures - a none academic explanation that normal programmers can understand!

See this article which I have repeated below:

http://www.javascriptkit.com/javatutors/closures.shtml

It refers to closures in JavaScript but the explanation applies equally to C# delegates.

A closure is the local variables for a function - kept alive after the function has returned, or

A closure is a stack-frame which is not deallocated when the function returns. (as if a ’stack-frame’ were malloc’ed instead of being on the stack!)

Look at the article for the fuller explaination.

http://www.javascriptkit.com/javatutors/closures.shtml

 

Tags: ,

Leave a Reply

You must be logged in to post a comment.