Thursday 5 September 2019

c# - Can someone explain it to me what closure is in real simple language ?











I am currently looking at lambda expression and the word closure keeps coming. Can someone explain it to me in real simple language.


Answer



I'd say this is a duplicate of: What are ‘closures’ in .NET?



"In essence, a closure is a block of code which can be executed at a later time, but which maintains the environment in which it was first created - i.e. it can still use the local variables etc of the method which created it, even after that method has finished executing."


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...