public string GetStringText(TreeNode node)
{
string str = ""; if (node == null)
return str;
else
{
str = node.Text.Trim() +"<--" + str; if (node.Parent != null)
{
this.GetStringText(node.Parent);
}
else
return str.Substring(0,str.Length-3);
}
}
总是报‘并非所有的代码路径都返回值’
大家帮我看看
{
string str = ""; if (node == null)
return str;
else
{
str = node.Text.Trim() +"<--" + str; if (node.Parent != null)
{
this.GetStringText(node.Parent);
}
else
return str.Substring(0,str.Length-3);
}
}
总是报‘并非所有的代码路径都返回值’
大家帮我看看
if (node.Parent != null)
{
this.GetStringText(node.Parent);
}
{
if (node.Parent == null)
return node.Text.Trim();
else
{
return node.Text.Trim() + "<--" + this.GetStringText(node.Parent);
}
}
//是否为LZ想要实现的?
{
return this.GetStringText(node.Parent);
}
return str;
else
{
str = node.Text.Trim() + "<--" + str; if (node.Parent != null)
{
this.GetStringText(node.Parent);
//add
return "xxx";
}
else
return str.Substring(0, str.Length - 3);
}