How do you search a large text file for a string without going line by line in C#?

后端 未结 14 1811
灰色年华
灰色年华 2020-12-15 08:23

I have a large text file that I need to search for a specific string. Is there a fast way to do this without reading line by line?

This method is extremely slow beca

14条回答
  •  南方客
    南方客 (楼主)
    2020-12-15 08:59

    If you want to speed up the line-by-line reading you can create a queue-based application:
    One thread reads the lines and enqeues them into a threadsafe Queue. A second one can then process the strings

提交回复
热议问题