TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
 
C# Coding Standard
Search

Rule:  5@108Checked automatically with code checker

Synopsis:Do not re-declare a visible name in a nested scope
Language:C#
Severity Level:2
Category:Object lifecycle


Description:

Repeating a name that already occurs in an outer scope is seldom intended and may be surprising in maintenance, although the behaviour is well-defined.

int foo = something;

if (whatever)
{
	double foo = 12.34;	
        double anotherFoo = foo; // Violation.
}