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; }
/// <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(); }
/// <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) { }