假如类似: public bool IsExits() { if(条件) { //代码 return true; } } 这种情况就会提示'并非所有的代码路径都返回值',因为条件成立了它才会返回boolean值,如果条件不成立呢? 所以要改成类似: public bool IsExits() { boolean b = false; if(条件) { //代码 return b = true; } return b; } 确保它无论如何都会返回值。
public bool IsExits() { bool reutrn_str=false; /* 运算,例如: reutrn_str=true; */ return return_str; }
110,535
社区成员
642,577
社区内容
加载中
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧