标签:
using System; using System.IO; using System.Text; namespace CSharpConvertString2Stream { class Program { static void Main( string[] args ) { string str = "This is the test string."; //convert string to stream byte[] array = Encoding.ASCII.GetBytes(str); MemoryStream stream = new MemoryStream(array); //convert stream to string StreamReader reader = new StreamReader(stream); string text = reader.ReadToEnd(); Console.WriteLine(text); Console.ReadLine(); } } }
标签:
原文地址:http://www.cnblogs.com/xinaixia/p/4788077.html