Actually, I’d like to know where is this file came from, and what does this file provides.
streamReader.ReadToEnd works on unicode strings, CR (carriage return) or \r is different to LF (new line) \n. This is a long story of Unix and Windows of reading/writing files. Some application changes this automatically or ignore, depending on the system and in programming it depends also how the method provide you the solution.
Anyway, you can use:
|
Quote:
string[] names = Regex.Split(text, "\r\n");
string[] names = text.Split('\r');
|
Please take note also in comparing strings in .NET, they eventually compare it first by length of your string, which very effective when it comes to large searching and matching. Try to evaluate your code by under this on for loop.
|
Quote:
Console.WriteLine("{0}, {1}", i.ToString().Length, value.Length);
|
IMHO, you should practice using BufferedStream especially if you are soon to read larger than 4096 bytes (not pretty sure on this) and combining it with NetworkStream, they work both smoothly.
Have fun… GoodLuck. I'm enjoying myself studying on this thing :-d