SEARCH C# PROGRAMMING CODES HERE

Stream Reader

Stream Reader in C#
StreamReader class is utilized to read the string from the stream. It acquires the Text Reader class. It provide Read() and ReadLine() techniques to read information from the stream. The information from the record is first perused into the stream From that point, the application peruses the information from the stream.

Program

using System;
using System.IO;

namespace program
{
    class Program
    {
        static void Main(string[] args)
        {
                                                      /*Existing file path*/
            FileStream fs = new FileStream("d:\\File.txt", FileMode.Open);
            StreamReader sr = new StreamReader(fs);
            string line = sr.ReadLine();
            Console.WriteLine("Text File Opened");
            Console.WriteLine(line);
            Console.ReadKey();
         }     
    }
 }

 Output
Text File Opened
Rohit Programming zone