コード例 #1
0
 public static async Task <List <string> > ReadLinesAsync(string filePath, Encoding defaultEncoding)
 {
     using (var stream = FileStreamEx.OpenAsyncReadFileStream(filePath))
         using (var reader = new StaticEncodingLineReader(stream, defaultEncoding))
         {
             return(await reader.ReadLinesAsync().ConfigureAwait(false));
         }
 }
コード例 #2
0
        public static async Task <IEnumerable <string> > ReadLinesAsync(string filePath, Encoding encoding)
        {
            if (filePath == null)
            {
                throw new ArgumentNullException(nameof(filePath));
            }

            using (var stream = FileStreamEx.OpenAsyncReadFileStream(filePath))
                using (var reader = new StaticEncodingLineReader(stream, encoding))
                {
                    return(await reader.ReadLinesAsync().ConfigureAwait(false));
                }
        }