![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
using System; using System.IO; using System.Text; namespace CSharpConvertString2Stream { class Program { static void Main( string[] args ) { string str = "Testing 1-2-3"; //convert string 2 stream byte[] array = Encoding.ASCII.GetBytes(str); MemoryStream stream = new MemoryStream(array); //convert stream 2 string StreamReader reader = new StreamReader(stream); string text = reader.ReadToEnd(); Console.WriteLine(text); Console.ReadLine(); } } }