Popular Posts

Jun 13, 2012

Read Text File In C#

      using (StreamReader sr = new StreamReader(@"C:\TextFile\text.txt"))
            {
                String line;
                // Read line by line
                while ((line = sr.ReadLine()) != null)
                {
                    Console.WriteLine(line);
                }
            }
            Console.ReadKey();

No comments:

Post a Comment