Which are the rules apply to a variable scope in lambda expressions?

 Posted by vishalneeraj-24503 on 9/30/2014 | Category: LINQ Interview questions | Views: 832 | Points: 40
Answer:

1). A variable used in lambda expression won't be garbage-collected until the delegate that references that variable is out of the scope.
2). Variables used in a lambda expression won’t be accessible in the parent method.
3). A lambda expression can’t get a ref or out parameter from an containing method.
4). The return statement used in a lambda expression won’t return for the enclosing method.
5). A lambda expression does not support a goto, break or continue statement who point t outer the body.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response