コード例 #1
0
 /// <summary>
 /// Construct a new CSV writer to produce output on the enclosed StreamWriter
 /// </summary>
 /// <param name="dest">The stream where this CSV will be outputted</param>
 /// <param name="settings">The CSV settings to use when writing to the stream (Default: CSV)</param>
 public CSVWriter(StreamWriter dest, CSVSettings settings = null)
 {
     _writer   = dest;
     _settings = settings;
     if (_settings == null)
     {
         _settings = CSVSettings.CSV;
     }
     _riskyChars          = _settings.GetRiskyChars();
     _forceQualifierTypes = _settings.GetForceQualifierTypes();
 }
コード例 #2
0
ファイル: CSV.cs プロジェクト: tspence/csharp-csv-reader
        public static string ToCSVString(this IEnumerable <object> row, CSVSettings settings = null)
#endif
        {
            if (settings == null)
            {
                settings = CSVSettings.CSV;
            }
            var riskyChars          = settings.GetRiskyChars();
            var forceQualifierTypes = settings.GetForceQualifierTypes();

            return(ItemsToCsv(row, settings, riskyChars, forceQualifierTypes));
        }
コード例 #3
0
ファイル: CSV.cs プロジェクト: tspence/csharp-csv-reader
        private static void AppendCSVRow(this StringBuilder sb, IEnumerable <object> row, CSVSettings settings = null)
#endif
        {
            if (settings == null)
            {
                settings = CSVSettings.CSV;
            }

            var riskyChars          = settings.GetRiskyChars();
            var forceQualifierTypes = settings.GetForceQualifierTypes();
            var csv = ItemsToCsv(row, settings, riskyChars, forceQualifierTypes);

            sb.Append(csv);
            sb.Append(settings.LineSeparator);
        }