I am in the process of resharpening my solution, using the just-released version of Resharper (2016.2.2)
It flags this line of code:
// Adapted from https://stackoverflow.com/questions/26483496/is-it-possible-to-ignore-excel-warnings-when-generating-spreadsheets-using-epplu
public static void ConvertValueToAppropriateTypeAndAssign(this ExcelRangeBase range, object value)
string strVal = value.ToString();
if (decimal.TryParse(strVal, out decVal))
range.Value = decVal;
if (double.TryParse(strVal, out dVal))
range.Value = dVal;
else if (Int32.TryParse(strVal, out iVal))
range.Value = iVal;
range.Value = strVal;
range.Value = null;
As some of the comments have indicated, this is at least partially a preference issue. Personally, I think it's "cleaner" and clearer to use an extension method here but some people may disagree with this.
"Under the hood," of course, the extension method is a static method (not an actual instance method), it's just that the compiler's giving you some syntactic sugar here (but that's besides the point).