private void initializeFunction(AggregateFunction aggregateFunction) { switch (aggregateFunction) { case AggregateFunction.Average: ColumnAggregateFunction = new Average { DisplayFormatFormula = DisplayFormatFormula }; break; case AggregateFunction.Maximum: ColumnAggregateFunction = new Maximum { DisplayFormatFormula = DisplayFormatFormula }; break; case AggregateFunction.Minimum: ColumnAggregateFunction = new Minimum { DisplayFormatFormula = DisplayFormatFormula }; break; case AggregateFunction.StdDev: ColumnAggregateFunction = new StdDev { DisplayFormatFormula = DisplayFormatFormula }; break; case AggregateFunction.Sum: ColumnAggregateFunction = new Sum { DisplayFormatFormula = DisplayFormatFormula }; break; case AggregateFunction.Variance: ColumnAggregateFunction = new Variance { DisplayFormatFormula = DisplayFormatFormula }; break; case AggregateFunction.Empty: ColumnAggregateFunction = new Empty { DisplayFormatFormula = DisplayFormatFormula }; break; default: throw new NotSupportedException("Please select a defined IAggregateFunction."); } }