Click here to Skip to main content
Rate this: bad
good
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();
                    }
                }
            }
            reader.Close();
Posted 3-Feb-13 5:28am
Edited 3-Feb-13 5:40am
v3
Comments
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...
—SA

1 solution

Rate this: bad
good
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?
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 CHill60 360
1 Sarvesh Kumar Gupta 238
2 OriginalGriff 163
3 Sergey Alexandrovich Kryukov 163
4 DamithSL 153


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