Click here to Skip to main content
13,045,285 members (76,340 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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[1].Value;
            while ((line = reader.ReadToEnd().ToLower()) != null)
                if (line.Contains('email'))
                    string[] crefids3 = line.Split(':');
                    for (int mj = 0; mj < crefids3.Length; mj++)
                        randomName = crefids3[1].ToString();
Posted 3-Feb-13 5:28am
Updated 3-Feb-13 5:40am
If you ask "how to do something", don't say "without this or that", because it may make no sense. Or at least explain it...

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 3 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100