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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -