String Writer

In this chapter you will learn:

  1. Writing to a string

Writing to a string

us
ing System;/*from j  a v  a  2 s . co m*/
using System.IO;

public class MainClass
{
    public static void Main()
    {
    
        StringWriter writer = new StringWriter();
        writer.Write("Name: {0}, Age: {1}", "Henry", 32);
        Console.WriteLine(writer.ToString());
    }
}

The code above generates the following result.

Next chapter...

What you will learn in the next chapter:

  1. Load xml from xml file directly
Home » C# Tutorial » Stream
Stream classes
Text File Read
Text File write
Text File Create
Text File Append
Replace File Content
BinaryReader
BinaryWriter
FileStream Create
FileStream byte read and write
BufferedStream
Compare File
File Copy
File Copy with FileStream
MemoryStream
Object Serialization
String Writer