Esempio n. 1
0
 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;
 }
Esempio n. 2
0
        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;
        }