示例#1
0
        public CsvWriter(Stream stream, CsvWriterSettings settings)
        {
            this.Settings = settings == null ? new CsvWriterSettings() : settings.Clone();

            if (settings.Encoding != null)
            {
                Writer = new StreamWriter(stream, settings.Encoding);
            }
            else
            {
                Writer = new StreamWriter(stream);
            }
            Settings.Encoding = Writer.Encoding;
            Settings.Readonly = true;
        }
示例#2
0
        /// <summary>
        /// Initializes a CsvWriter for a given stream and using the specified settings
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="settings"></param>
        /// <param name="leaveOpen"></param>
        public CsvWriter(Stream stream, CsvWriterSettings settings, bool leaveOpen)
        {
            this.Settings   = settings == null ? new CsvWriterSettings() : settings.Clone();
            this._leaveOpen = leaveOpen;

            if (settings.Encoding != null)
            {
                Writer = new StreamWriter(stream, settings.Encoding);
            }
            else
            {
                Writer = new StreamWriter(stream);
            }
            Settings.Encoding = Writer.Encoding;
            Settings.Readonly = true;
            Configure();
        }
示例#3
0
 /// <summary>
 /// Initializes a CsvWriter for a given stream and using the specified settings
 /// </summary>
 /// <param name="stream"></param>
 /// <param name="settings"></param>
 public CsvWriter(Stream stream, CsvWriterSettings settings)
     : this(stream, settings, false)
 {
 }