C
CSharper
I have a situation where I have file with all the find and replace
values, I read it and put it in a dictionary format. Next I have to
read all the files in a given directory and read each line in each
file and apply regex on it. The way I am doing it is, not the real
code but for an idea...
foreach(file in directory)
{
filehandle = file.open(file)
foreach(line in filehandle)
{
RegEx = new Regex()
....
}
}
This part of the program is taking lot of time to execute (roughly 10
minutes). I think the problem is due to the regex instantiation for
each line in the file. What is the better way to do this? Do you think
an extension method will resolve the problem or using lambda or linq??
Thanks.
values, I read it and put it in a dictionary format. Next I have to
read all the files in a given directory and read each line in each
file and apply regex on it. The way I am doing it is, not the real
code but for an idea...
foreach(file in directory)
{
filehandle = file.open(file)
foreach(line in filehandle)
{
RegEx = new Regex()
....
}
}
This part of the program is taking lot of time to execute (roughly 10
minutes). I think the problem is due to the regex instantiation for
each line in the file. What is the better way to do this? Do you think
an extension method will resolve the problem or using lambda or linq??
Thanks.