EDIT
I leave it here, although it makes me look stupid, because it is a subtle mistake that can bite you if you work late at night and do not pay attention. Kudos to Visual Studio for such an intelligent parser.
I basically skipped that I have nested loops, so the statement is continueuseless here because it continues the loop foreach, not the loop for.
ORIGINAL QUESTION
I run a search in a workbook, looking for a worksheet that matches all string search criteria. In the editor, Visual Studio is i++underlined as "unreachable code."
public static ISheet FindSheet( this IWorkbook wb, params string[] searches )
{
if( null == wb || null == searches )
return null;
for( int i = 0; i < wb.NumberOfSheets; i++ )
{
var sheet = wb.GetSheetAt( i );
foreach( var search in searches )
{
var cell = sheet.FindCell( search );
if( null == cell )
continue;
}
return sheet;
}
return null;
}
, continue : " - null, . , ".
public static ISheet FindSheet( this IWorkbook wb, params string[] searches )
{
if( null == wb || null == searches )
return null;
for( int i = 0; i < wb.NumberOfSheets; i++ )
{
var sheet = wb.GetSheetAt( i );
if( searches.All( s => null != sheet.FindCell( s ) ) )
return sheet;
}
return null;
}