Create StringReader from String : StreamReader : File Directory Stream C# Examples


C# Examples » File Directory Stream » StreamReader »

 

Create StringReader from String









    
using  System;
using  System.IO;
using  System.Text;

class  MainClass
{
    public  static  void  Main()  
    {
        StringBuilder  sb  =  new  StringBuilder();

        StringWriter  sw  =  new  StringWriter(sb);

        sw.Write("This  is  a  test  of  the  StringWriter  class");
        sw.Close();

        StringReader  sr  =  new  StringReader(sb.ToString());

        string  EntireString;
    
        EntireString  =  sr.ReadToEnd();
        Console.WriteLine(EntireString);

        sr.Close();
    }
}
    
   
  
   



Output

This is a test of the StringWriter class


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo File Directory Stream
» StreamReader