I have the following code that does not raise warning CA1804 (declared variable is never used) from code analysis (VS2010 Premium):
...
if( boolVariable )
{
string errorText = "Bla Bla Bla";
ErrorProvider.SetError( SomeControl, "Some Warning" );
}
else
{
string errorText = "Acme Acme Acme";
ErrorProvider.SetError( SomeControl, errorText );
}
...
When I delete the ErrorProvider.SetError (...) lines, warning CA1804 is displayed, but why is this not the case in the code example above?
(Btw: the code itself is not too large and just shown to illustrate my question.)
, ? , , IL , if, , , , , , , .
G.