1 using  System; 
2 using System.IO;
3 using System.Text;
4 namespace CSharpConvertString2Stream
5 {
6 class Program
7 {
8 static void Main( string [] args )
9 {
10 string str = " Testing 1-2-3 " ; // convert string 2 stream
11 byte [] array = Encoding.ASCII.GetBytes(str);
12 MemoryStream stream = new MemoryStream(array); // convert stream 2 string
13 StreamReader reader = new StreamReader(stream);
14 string text = reader.ReadToEnd();
15 Console.WriteLine(text) ;
16 Console.ReadLine();
17 }
18 }
19 }

相关文章:

  • 2021-10-05
  • 2022-12-23
  • 2022-02-17
  • 2022-12-23
  • 2021-05-20
  • 2022-12-23
  • 2021-07-03
  • 2021-12-10
猜你喜欢
  • 2022-01-27
  • 2021-10-10
  • 2022-12-23
  • 2021-07-22
  • 2022-12-23
  • 2021-11-26
相关资源
相似解决方案