Ejemplo n.º 1
0
 /// <summary>
 /// Reads lines from a specific stream.
 /// </summary>
 /// <param name="file">The file to read.</param>
 /// <param name="encoding">The character encoding to use.</param>
 /// <param name="removeEmptyLine">true if need remove the empty line; otherwise, false.</param>
 /// <returns>Lines from the specific stream reader.</returns>
 /// <exception cref="ArgumentNullException">file was null.</exception>
 /// <exception cref="FileNotFoundException">file was not found.</exception>
 /// <exception cref="DirectoryNotFoundException">The directory of the file was not found.</exception>
 /// <exception cref="NotSupportedException">Cannot read the file.</exception>
 /// <exception cref="IOException">An I/O error occurs.</exception>
 public static IEnumerable <string> ReadLines(this FileInfo file, Encoding encoding, bool removeEmptyLine = false)
 => CharsReader.ReadLines(file, encoding, removeEmptyLine);
Ejemplo n.º 2
0
 /// <summary>
 /// Reads lines from a specific stream.
 /// </summary>
 /// <param name="file">The file to read.</param>
 /// <param name="detectEncodingFromByteOrderMarks">true if look for byte order marks at the beginning of the file; otherwise, false.</param>
 /// <param name="removeEmptyLine">true if need remove the empty line; otherwise, false.</param>
 /// <returns>Lines from the specific stream reader.</returns>
 /// <exception cref="ArgumentNullException">file was null.</exception>
 /// <exception cref="FileNotFoundException">file was not found.</exception>
 /// <exception cref="DirectoryNotFoundException">The directory of the file was not found.</exception>
 /// <exception cref="NotSupportedException">Cannot read the file.</exception>
 public static IEnumerable <string> ReadLines(this FileInfo file, bool detectEncodingFromByteOrderMarks, bool removeEmptyLine = false)
 => CharsReader.ReadLines(file, detectEncodingFromByteOrderMarks, removeEmptyLine);
Ejemplo n.º 3
0
 /// <summary>
 /// Reads lines from a specific stream reader.
 /// </summary>
 /// <param name="reader">The stream reader.</param>
 /// <param name="removeEmptyLine">true if need remove the empty line; otherwise, false.</param>
 /// <returns>Lines from the specific stream reader.</returns>
 /// <exception cref="NotSupportedException">The stream does not support reading.</exception>
 /// <exception cref="IOException">An I/O error occurs.</exception>
 /// <exception cref="ObjectDisposedException">The stream has disposed.</exception>
 public static IEnumerable <string> ReadLines(this TextReader reader, bool removeEmptyLine = false)
 => CharsReader.ReadLines(reader, removeEmptyLine);