Create StringWriter from StringBuilder - CSharp File IO

CSharp examples for File IO:String Reader Writer

Description

Create StringWriter from StringBuilder

Demo Code


using System;//  w w w .  j av  a2 s.  c  om
using System.IO;
using System.Text;

public class Program
{
    public static void Main(string[] args)
    {
        string emily = "Hope is the thing with feathers\nThat perches in the soul...\n--Emily Dickinson";
        StringBuilder builder = new StringBuilder();
        StringWriter writer2 = new StringWriter(builder);
        foreach (string item in emily.Split(new char[] { '\n' }))
        {
            writer2.WriteLine(item);
        }
    }
}

Related Tutorials