public TypedCsvRecord(T value, CsvFormat format) { Record = CsvRecord.From(value, format); Value = value; }
public CsvRecord WithFormat(CsvFormat format) { return(new CsvRecord(Header?.WithFormat(format), _values, format)); }
public string ToString(CsvFormat format) { return(CsvUtility.ToCsvString(_values, format)); }
/// <summary> /// Initializes a new instance of the <see cref="CsvWriter"/> class. /// </summary> /// <param name="path">The path.</param> /// <param name="format">The format.</param> public CsvWriter(string path, CsvFormat format) : this(path, format, flexible : false) { }
/// <summary> /// Initializes a new instance of the <see cref="CsvWriter"/> class. /// </summary> /// <param name="path">The path.</param> /// <param name="format">The format.</param> /// <param name="flexible">if set to <c>true</c> the writer will allow records of diferent lenghts.</param> public CsvWriter(string path, CsvFormat format, bool flexible) : this(new StreamWriter(path, append : true), format, flexible) { }
/// <summary> /// Creates a csv header from the specified values and format. /// </summary> /// <param name="format">The format.</param> /// <param name="values">The values.</param> /// <returns>A csv header with the specified values</returns> public static CsvHeader FromValues(CsvFormat format, params string[] values) { return(new CsvHeader(values, format)); }
/// <summary> /// Creates a csv header for the specified type. /// </summary> /// <typeparam name="T">Type used to create the header</typeparam> /// <param name="format">The format.</param> /// <returns>The header using the names of the public fields and properties of the specified type.</returns> public static CsvHeader FromType <T>(CsvFormat format) { var values = CsvUtility.GetHeader <T>(); return(new CsvHeader(values, format)); }
/// <summary> /// Creates a copy of this document with the specified csv format. /// </summary> /// <param name="format">The format.</param> /// <returns>A copy using the specified format.</returns> public CsvDocument WithFormat(CsvFormat format) { return(new CsvDocument(_records.ToList(), Header.WithFormat(format), format, IsFlexible)); }
public CsvHeader WithFormat(CsvFormat format) { return(new CsvHeader(_values, format)); }
public CsvDocument(IEnumerable <string> header, CsvFormat format) : this(header, format, false) { }
/// <summary> /// Initializes a new instance of the <see cref="CsvReader"/> class. /// </summary> /// <param name="path">The path.</param> /// <param name="format">The format.</param> /// <param name="hasHeader">if set to <c>true</c> the first record will be considered the header.</param> public CsvReader(string path, CsvFormat format, bool hasHeader) : this(new StreamReader(path), format, hasHeader) { }
/// <summary> /// Initializes a new instance of the <see cref="CsvReader"/> class. /// </summary> /// <param name="path">The path.</param> /// <param name="format">The format.</param> public CsvReader(string path, CsvFormat format) : this(path, format, true) { }
/// <summary> /// Initializes a new instance of the <see cref="CsvDocument{T}"/> class. /// </summary> /// <param name="format">The format.</param> public CsvDocument(CsvFormat format) { Header = new CsvHeader(CsvUtility.GetHeader <T>(), format); Format = format; }
/// <summary> /// Gets a copy of this csv with the specified format. /// </summary> /// <param name="format">The format.</param> /// <returns></returns> public CsvDocument <T> WithFormat(CsvFormat format) { return(new CsvDocument <T>(_records.ToList(), Header.WithFormat(format), format)); }