c# - Why does Resharper offer to "Remove Unreachable Code" here? -
inspecting project i've inherited resharper, first suggested wrap this:
if (cellrng != null)
...around code, cellrng acted on if it's not null. after doing that, tells me "if block" code not reachable, anyway. here code in context:
if (cellrng != null) { cellrng.font.bold = true; cellrng.value2 = ave.tostring(cultureinfo.invariantculture); cellrng.numberformat = "##0.00"; cellrng.horizontalalignment = xlhalign.xlhaligncenter; . . . }
how can code both reference possibly null object (cellrng) , then, after check implemented, turn out null (code runs if not null considered unreachable)?
in second line below, resharper offers remove code, saying, "expression null"
cellrng = _xlsheet5.cells[rowidx, colcnt] range; if (cellrng != null)
but how that? how range assigned cellrng seen null?
the code in if block following code above tagged resharper "code heuristically unreachable"
what czech!?!?!
Comments
Post a Comment