February 15, 2013

Closures in C#

Tricky topic to understand, this is is the simplest explanation I've found.

What?
A Closure is a function which can be passed around like an object but it also can maintain state in it's local variables.

Why?
Useful in asynchronous calls where you want something to happen when the task ends, the local variables can be used to store something that should be included in the work that needs to be done when the task completes.
Particularly useful in Javascript.

1 comment:

milecar said...

You blog is perfect for Real Estate MLS lising bloger. I feel happy to read your unqique & information blog. Also another good information is available at Red Deer MLS, Alberta to find the perfect house!  View virtual tours, send my listings to family and friends, and use my exciting map search!