M
mp
I tried to use a ref parameter in a method
private string GetCommentFromLine(string Origline,ref string CleanedLine)
{
int pos = Origline.IndexOf(";", 1);
if (pos > 0)
{
MessageBox.Show("Has comment");
return Origline.Substring(pos);
CleanedLine=Origline.Substring(1,pos-1);
}
else
{MessageBox.Show("Has no comment");
return "";
}
}
i get the error
Warning 1 Unreachable code detected
at "CleanedLine" in the line:
CleanedLine=Origline.Substring(1,pos-1);
what am i doing wrong?
private string GetCommentFromLine(string Origline,ref string CleanedLine)
{
int pos = Origline.IndexOf(";", 1);
if (pos > 0)
{
MessageBox.Show("Has comment");
return Origline.Substring(pos);
CleanedLine=Origline.Substring(1,pos-1);
}
else
{MessageBox.Show("Has no comment");
return "";
}
}
i get the error
Warning 1 Unreachable code detected
at "CleanedLine" in the line:
CleanedLine=Origline.Substring(1,pos-1);
what am i doing wrong?