public CsvRow.ICsvRowBuilderFinisher AddUsingMapper(Action <CsvRow.ICsvRowMapper> mapper) { if (mapper == null) { throw new ArgumentNullException("mapper"); } if (this._headers == null) { throw new InvalidOperationException("No headers were passed so this method is not allowed."); } CsvRow.CsvRowMapper csvRowMapper = new CsvRow.CsvRowMapper(this._headers); mapper(csvRowMapper); this.Add(csvRowMapper.ToData()); return(this); }
public CsvRow.ICsvRowBuilderFinisher FromUsingMapper <T>(IEnumerable <T> elements, Action <CsvRow.ICsvRowMapper, T> mapper) { if (elements == null) { throw new ArgumentNullException("elements"); } if (mapper == null) { throw new ArgumentNullException("mapper"); } if (this._headers == null) { throw new InvalidOperationException("No headers were passed so this method is not allowed."); } elements.ForEach <T>((T x) => { CsvRow.CsvRowMapper csvRowMapper = new CsvRow.CsvRowMapper(this._headers); mapper(csvRowMapper, x); this.Add(csvRowMapper.ToData()); }); return(this); }