I have the following code:
if (Current == false)
{
foreach (var visual in visuals)
visual.IsSelected = value;
}
Visual visual = visuals[currentIndex];
And when I compile I have this error:
A local variable named 'visual' cannot be declared in this scope because it would give a different meaning to 'visual', which is already used in a 'child' scope to denote something else
Also, if I don't declare the visual
variable, that is I replace:
Visual visual = visuals[currentIndex];
with:
visual = visuals[currentIndex];
the error is the following:
The name 'visual' does not exist in the current context
Why this behavior?