IValueSource IColumnMapping.ValueSource(CsvData data, CsvData headers) { var mapping = this.As <IColumnMapping>(); var badColumns = new List <string>(); var columns = headers .Values .Select(x => { var column = mapping.ColumnFor(x); if (column == null) { badColumns.Add(x); } return(column); }).ToArray(); if (badColumns.Any()) { throw new CsvColumnException(badColumns); } return(data.ToValueSource(columns)); }
IValueSource IColumnMapping.ValueSource(CsvData data) { return(data.ToValueSource(_columns)); }