There is a simple way to “reduce” (at least “decorate”) the for outline ... this will not be more indicative, so you choose:
bool do = true; for(var j = 0; j < 9; j++) { if (excel_getValue("A" + (i+j)) != "") { do = false; break; } } if(do) { }
Or using Linq:
if(Enumerable.Range(0, 9).All(x => excel_getValue("A" + (i + x)) == "")) { }
It can probably be easily shortened, but I think the point is that it should be “prettier” and not “better” or “difficult”. Nothing would change your initial level of performance :-)
source share