コード例 #1
0
ファイル: TypedCsvRecord.cs プロジェクト: Neo-Ciber94/FastCSV
 public TypedCsvRecord(T value, CsvFormat format)
 {
     Record = CsvRecord.From(value, format);
     Value  = value;
 }
コード例 #2
0
 public CsvRecord WithFormat(CsvFormat format)
 {
     return(new CsvRecord(Header?.WithFormat(format), _values, format));
 }
コード例 #3
0
 public string ToString(CsvFormat format)
 {
     return(CsvUtility.ToCsvString(_values, format));
 }
コード例 #4
0
 /// <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)
 {
 }
コード例 #5
0
 /// <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)
 {
 }
コード例 #6
0
ファイル: CsvHeader.cs プロジェクト: Neo-Ciber94/FastCSV
 /// <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));
 }
コード例 #7
0
ファイル: CsvHeader.cs プロジェクト: Neo-Ciber94/FastCSV
        /// <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));
        }
コード例 #8
0
 /// <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));
 }
コード例 #9
0
ファイル: CsvHeader.cs プロジェクト: Neo-Ciber94/FastCSV
 public CsvHeader WithFormat(CsvFormat format)
 {
     return(new CsvHeader(_values, format));
 }
コード例 #10
0
 public CsvDocument(IEnumerable <string> header, CsvFormat format) : this(header, format, false)
 {
 }
コード例 #11
0
 /// <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)
 {
 }
コード例 #12
0
 /// <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)
 {
 }
コード例 #13
0
 /// <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;
 }
コード例 #14
0
 /// <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));
 }