VS里Add-in开发错误提示GetLayerByName(string lyrName)不是所有的代码都有的代码路径都有返回值怎么改呢?求各位大神帮忙
namespace GIStools{
public class search : ESRI.ArcGIS.Desktop.AddIns.Tool
{
private IApplication m_application;
private static IMap map;
public search()
{
}
protected override void OnUpdate()
{
Enabled = ArcMap.Application != null;
}
public static ILayer GetLayerByName(string lyrName)
{
ILayer findLayer = null;
IEnumLayer pEnumLayer = map.get_Layers();
pEnumLayer.Reset();
ILayer pLayer = pEnumLayer.Next();
while (pLayer != null)
{
if (pLayer.Name == lyrName)
{
findLayer = pLayer;
}
pLayer = pEnumLayer.Next();
return findLayer;
}
}
}
}