Use StringWriter to write string : StringWriter : File Stream C# Source Code


Custom Search

C# Source Code » File Stream » StringWriter »

 

Use StringWriter to write string








    


using System;
using System.IO;
using System.Text;
class StringReadWriteApp {
    static void Main(string[] args) {
        StringWriter w = new StringWriter();
        w.WriteLine("Sing a song of {0} pence", 6);
        string s = "A pocket full of rye";
        w.Write(s);
        w.Write(w.NewLine);
        w.Write(String.Format(4 + " and " + 20 + " blackbirds"));
        w.Write(new StringBuilder(" baked in a pie"));
        w.WriteLine();
        w.Close();
        Console.WriteLine(w);
    }
}
           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo File Stream
» StringWriter