modify a variable in a anonymous method
- by Navid Farhadi
I want to modify a local variable in a function of extension method.
See
int myvar=0;
MyList.Where(
x =>
{
if (condition)
myvar += 1;
return false;
});
return myvar;
But that is not working. What is the problem.