/// <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()); } }
public static CsvLine <TRow>[] FromStreamVerbose <TRow>(this TableDataMapper <TRow> mapper, Stream stream, Encoding encoding, bool detectEncoding) where TRow : new() { var reader = new CsvStreamReader(stream, encoding, detectEncoding) { ElementDelimiter = mapper.Definition.ElementDelimiter, HasFieldsEnclosedInQuotes = mapper.Definition.HasFieldsEnclosedInQuotes }; return(mapper.GetRows(reader).ToArray()); }