c# - How can I print values from a text file in the console? -


i've been trying read values values.txt file , print them in console using c#. appears work. i've debugged code , found nothing wrong , program compiling. problem values wont appear on console. prints empty lines.

here's code :

using system; using system.collections.generic; using system.io; using system.linq; using system.text; using system.threading.tasks;  namespace testfilereadtest {     class program     {         static void main(string[] args)         {             streamreader myreader = new streamreader("values.txt");             string line = "";              while (line != null)             {                 line = myreader.readline();                 if (line!= null)                     console.writeline();             }             myreader.close();             console.writeline("allo");             console.readline();         }     } } 

i'm using visual studio express 2013

nowhere print values console.

you print empty line here:

console.writeline(); 

you meant print line variable:

console.writeline(line); 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -