public ColumnInfoBase(string headerName, string valueFunction) { //if (String.IsNullOrWhiteSpace(headerName)) { throw new ArgumentNullException("headerName"); } if (valueFunction == null) { throw new ArgumentNullException("valueFunction"); } this.HeaderName = headerName; this.CleanHeaderName = FileIOUtilities.FixupHeader(this.HeaderName); this.ValueFunctionString = valueFunction; this.CellType = ExcelCellType.General; }
public ColumnInfo(string headerName, Expression <Func <T, object> > valueFunction) { //if (String.IsNullOrWhiteSpace(headerName)) { throw new ArgumentNullException("headerName"); } if (valueFunction == null) { throw new ArgumentNullException("valueFunction"); } this.HeaderName = headerName; this.CleanHeaderName = FileIOUtilities.FixupHeader(this.HeaderName); this.ValueFunction = valueFunction.Compile(); var type = FileIOUtilities.GetExpressionType <T>(valueFunction); var notNullType = Nullable.GetUnderlyingType(type); this.ValueFunctionType = notNullType ?? type; this.CellType = ExcelCellType.General; }