using System;
using System.IO;
using System.Text;

namespace CSharp411
{
    class Program
    {
        static void Main( string[] args )
        {
            string test = "Testing 1-2-3";

            // 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();
        }
    }
}

 posted on 2009-12-24 10:48  maples  阅读(178)  评论(0)    收藏  举报