df********@hotm ail.com <df********@hot mail.com> wrote:
Trying to set a var
I get blue squig under "MyClass" says "Unreachabl e code detected "
public string getClass()
{
counta = counta + 1;
if (counta < 2 )
{
return ("rank_1");
MyClass mc = new MyClass();
mc.SetClass("ra nk_1");
}
else
{
return ("");
MyClass mc = new MyClass();
mc.SetClass("ra nk_6");
}
}
Yes, now you've posted different code, we can see why - "return"
returns immediately. In this case you can just move the return
statements to the ends of the blocks.
As a side note, this is an important example of why it's important to
post real code - the same code which is producing the problem -
especially if you don't understand exactly what's going on.
--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too