/// <summary> /// Reads the rows from a stream. /// </summary> /// <param name="lineReader">The CSV line reader.</param> /// <param name="stream">The stream.</param> /// <param name="encoding">The encoding.</param> /// <param name="detectEncoding">if set to <c>true</c> the encoding will be detected automaticly.</param> /// <returns> /// Returns the rows as an array. /// </returns> public static CsvLine[] FromStream(this CsvStreamLineReader lineReader, Stream stream, Encoding encoding, bool detectEncoding) { using (var reader = new CsvStreamReader(stream, encoding, detectEncoding)) { return(lineReader.GetRows(reader).ToArray()); } }
/// <summary> /// Reads the rows from a stream. /// </summary> /// <param name="lineReader">The CSV line reader.</param> /// <param name="stream">The stream.</param> /// <param name="encoding">The encoding.</param> /// <param name="detectEncoding">if set to <c>true</c> the encoding will be detected automaticly.</param> /// <param name="elementSeparator">The element separator characters.</param> /// <returns> /// Returns the rows as an array. /// </returns> public static CsvLine[] FromStream(this CsvStreamLineReader lineReader, Stream stream, Encoding encoding, bool detectEncoding, string elementSeparator) { using (var reader = new CsvStreamReader(stream, encoding, detectEncoding)) { reader.ElementDelimiter = elementSeparator; return(lineReader.GetRows(reader).ToArray()); } }