Wednesday 15 September 2010

c# - 4000 files that I want to do a string search on -


What is the best way to search for stars in multiple files?

Currently I am doing a foreach loop through each file, but it has been seen that it is known through 4000+ files for 4000 minutes

Are there parallel ways to do this?

This is the best way to do this. What do you do with this, you read a thread from the hard drive and the data is loaded in a queue, so you have to process other thread data indefinitely.

Then say your old code was

  foreach (some files in directory .gate files (some search) {string textToRead = file. Read all text (file);   

The new code will be

  var collection = new blocking code  (foreach (directory .gat files (some directory Search) {collection.Add (file.readltext (file)}} collection full add ();}); parallel.forh (archiving gatensuming enginereble (), ProcessText); // Make sure any action process text (class Increase any variable in the thread) is done in a secure way.   

What this does is allow it to read from a thread with any other thread for hard drive and I / O Do not fight, but this is all the threads all at the same time Has read does not process the data

No comments:

Post a Comment