- 1
1
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−103
1
−103
вайп
−147
вайп
+151
вайп
+153
вайп
+118
private Excel._Application _excel;
...
private void RefreshFormulas(FormulaRefreshOption formulaRefreshOption, object objectToRefresh)
{
//Где-то в дебрях километрового метода бросилось в глаза
...
try
{
Excel.Range intersection = selection, selection2 = selection;
while (selection2 != null)
{
intersection = _excel.Intersect(selection2, selection2.Dependents,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
System.Windows.Forms.Application.DoEvents();
excelUtilities.RecalculateRangeInstance(true, intersection/*_excel.Selection as Excel.Range*/);
selection2 = intersection;
}
}
catch (Exception) { /*ignore the exception because .Dependents will throw an exception if there aren't any dependents*/}
...
}
−329
1
+144
1
+145
1
+145
$var