zoukankan      html  css  js  c++  java
  • 大文件读取方法(C#)

    之前都是用StreamReader.ReadLine方法逐行读取文件,自从.NET4有了File.ReadLines这一利器,就再也不用为大文件发愁了。

    File.ReadLines在整个文件读取到内存之前就提供 IEnumerator 对象供程序操作,且回传对象IEnumerator更易于操作。因此File类的ReadLines方法特别适合操作大型文件。

    	var Fi = from line in File.ReadLines(openFileDialog1.FileName,Encoding.Default)
                 where line.ToLower().Contains("happy")
                 select new
                 {
                     Line = line
                 };
    

      

  • 相关阅读:
    软考
    码云
    vue和bpmnjs
    工作流引擎
    net core restapi
    工厂模式
    sqlmanage
    类的扩展
    导出excel
    拼图
  • 原文地址:https://www.cnblogs.com/globalwatch/p/3343341.html
Copyright © 2011-2022 走看看