StringWriter/Reader : StringWriter : Development Class C# Source Code


Custom Search

C# Source Code » Development Class » StringWriter »

 

StringWriter/Reader








    
 

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


class Program {
    static void Main(string[] args) {
        StringWriter strWriter = new StringWriter();
        strWriter.WriteLine("Don't forget Mother's Day this year...");
        strWriter.Close();

        Console.WriteLine(strWriter);

        StringBuilder sb = strWriter.GetStringBuilder();
        sb.Insert(0, "Hey!! ");
        Console.WriteLine("-> {0}", sb.ToString());

        sb.Remove(0, "Hey!! ".Length);
        Console.WriteLine("-> {0}", sb.ToString());

        StringReader strReader = new StringReader(strWriter.ToString());

        string input = null;
        while ((input = strReader.ReadLine()) != null) {
            Console.WriteLine(input);
        }
        strReader.Close();
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Development Class
» StringWriter