How to read a text after "Email:" via stream reader without looping ...Is there any easy method to get it fast as i am checking large number of files at a time....
StreamReader reader = new StreamReader(Target1);
string line = string.Empty;
var matches1 = Regex.Match('Email', ('^.*')).Groups.Value;
while ((line = reader.ReadToEnd().ToLower()) != null)
string crefids3 = line.Split(':');
for (int mj = 0; mj < crefids3.Length; mj++)
randomName = crefids3.ToString();
Depends on what you mean by "large". But if you really mean very large amounts then in general the answer is no. You might be able to increase the buffer size but that depends on the actual stream.
With care you might find that if you parse it first then process it you might get better performance (right now it looks like you are processing it once found.)
You might also examine your need to make it faster - specifically is this a business requirement or just something you think is ideal?
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)