您的方法支持返回ElectronicRecordAppellateCase
类的实例。我想你是在返回结果中的一些如果条件在你的方法或如此这般。
public ElectronicRecordAppellateCase CreateXml()
{
ElectronicRecordAppellateCase output=new ElectronicRecordAppellateCase();
if(someVariableAlreadyDefined>otherVariable)
{
//do something useful
return output;
}
// Not returning anything if the if condition is not true!!!!
}
解决方案:确保您从方法返回一个有效的返回值。
public ElectronicRecordAppellateCase CreateXml()
{
ElectronicRecordAppellateCase output=new ElectronicRecordAppellateCase();
if(someVariableAlreadyDefined>otherVariable)
{
return output;
}
return null; //you can return the object here as needed
}
显示的方法本身,而不是仅仅定义... – walther
这不是婆可以从你发布的内容中知道。该错误意味着有一个代码路径不会返回任何东西(缺少'else','case'之类的东西)。 – Oded
我编辑了你的标题。请参阅:“[应该在其标题中包含”标签“](http://meta.stackexchange.com/questions/19190/)”,其中的共识是“不,他们不应该”。 –