Variables introduced within lambda expression not visible in outer method - LINQ

Q.  Choose the correct one
- Published on 31 Aug 15

a. Variables introduced within a lambda expression are not visible in the outer method.
b. Variables introduced within a lambda expression are visible in the outer method.
c. The lambda should not contain the same number of parameters as the delegate type.
d. None of the above

ANSWER: Variables introduced within a lambda expression are not visible in the outer method.
 
A lambda expression is an anonymous function that you can use to create delegates
A variable, declared inside the anonymous method can’t be accessed outside the anonymous method but a variable, declared outside the anonymous method can be accessed inside the anonymous method.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)