C# From String to Stream, and From Stream to String

static void Main( string[] args )
{
    string test = "My sample text";

    // convert string to stream
    byte[] byteArray = Encoding.ASCII.GetBytes( test );
    MemoryStream stream = new MemoryStream( byteArray ); 

    // convert stream to string
    StreamReader reader = new StreamReader( stream );
    string text = reader.ReadToEnd();

    Console.WriteLine( text );
    Console.ReadLine();
}
static void Main( string[] args )
{
    string test = "My sample text";

    // convert string to stream
    MemoryStream stream = new MemoryStream();
    StreamWriter writer = new StreamWriter( stream );
    writer.Write( test );
    writer.Flush();

    // convert stream to string
    stream.Position = 0;
    StreamReader reader = new StreamReader( stream );
    string text = reader.ReadToEnd();
}