Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET
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
Edited 3-Feb-13 5:40am
Sergey Alexandrovich Kryukov at 3-Feb-13 20:38pm
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
0 Sergey Alexandrovich Kryukov 535
1 CPallini 450
2 OriginalGriff 270
3 George Jonsson 256
4 Suvabrata Roy 229
0 OriginalGriff 4,873
1 CPallini 3,900
2 Sergey Alexandrovich Kryukov 3,474
3 George Jonsson 2,646
4 Gihan Liyanage 2,236

Advertise | Privacy | Mobile
Web01 | 2.8.140905.1 | Last Updated 3 Feb 2013
Copyright © CodeProject, 1999-2014
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