/// <summary> /// Writes a list of custom csv objects directly to the csv stream and opens a new row. /// </summary> /// <typeparam name="TEntity">The custom csv object type</typeparam> /// <param name="csvTableWriter">The <see cref="CsvTableWriter"/></param> /// <param name="entities">List of csv custom objects</param> public static void WriteAll <TEntity>(this CsvTableWriter csvTableWriter, IEnumerable <TEntity> entities) { if (entities == null) { throw new ArgumentNullException(nameof(entities)); } foreach (var entity in entities) { csvTableWriter.SetValues(entity); csvTableWriter.Write(); } }
/// <summary> /// Writes values directly to the csv stream and opens a new row. /// </summary> /// <param name="csvTableWriter">The <see cref="CsvTableWriter"/></param> /// <param name="values">List of values</param> public static void Write(this CsvTableWriter csvTableWriter, IEnumerable <object> values) { if (values == null) { throw new ArgumentNullException(nameof(values)); } int i = 0; foreach (var value in values) { csvTableWriter.SetValue(i, value); i++; } csvTableWriter.Write(); }
/// <summary> /// Writes a custom csv object directly to the csv stream and opens a new row. /// </summary> /// <typeparam name="TEntity">The custom csv object type</typeparam> /// <param name="csvTableWriter">The <see cref="CsvTableWriter"/></param> /// <param name="entity">The csv custom object</param> public static void Write <TEntity>(this CsvTableWriter csvTableWriter, TEntity entity) { csvTableWriter.SetValues(entity); csvTableWriter.Write(); }
/// <summary> /// Writes values directly to the csv stream and opens a new row. /// </summary> /// <param name="csvTableWriter">The <see cref="CsvTableWriter"/></param> /// <param name="values">List of values</param> public static void Write(this CsvTableWriter csvTableWriter, params object[] values) { csvTableWriter.Write((IEnumerable <object>)values); }