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();
}
}
}
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
浙公网安备 33010602011771号