c# - StreamReader output -
in c# why output of 2 code different each other ?
streamreader test = new streamreader(@"c:\a.txt"); while (test.readline() != null) { console.writeline(test.readline()); }
and code :
streamreader test = new streamreader(@"c:\a.txt"); string line = ""; while ((line = test.readline()) != null) { console.writeline(line); }
each time call test.readline()
read 1 new line, first code skippes half of them.
Comments
Post a Comment