File.ReadAllLines : File : File Directory Stream C# Examples


C# Examples » File Directory Stream » File »

 

File.ReadAllLines









    
using  System;
using  System.Collections.Generic;
using  System.Text;
using  System.IO;

class  MainClass
{
        static  void  Main(string[]  args)
        {
                StreamWriter  writer  =  new  StreamWriter(@"c:\myfile.txt");
                for  (int  i  =  0;  i  <  3;  i++)
                {
                        writer.Write(i.ToString());
                }
                writer.Flush();
                writer.Close();

                foreach  (string  line  in  File.ReadAllLines(@"c:\myfile.txt"))
                {
                        Console.WriteLine(line);
                }
        }
}
    
   
  
   



Output

012


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo File Directory Stream
» File