惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The GitHub Blog
The GitHub Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Hacker News: Ask HN
Hacker News: Ask HN
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Schneier on Security
Schneier on Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
F
Full Disclosure
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Proofpoint News Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
罗磊的独立博客
S
Schneier on Security
H
Hacker News: Front Page
H
Heimdal Security Blog
美团技术团队
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
P
Privacy International News Feed
博客园 - 三生石上(FineUI控件)
P
Palo Alto Networks Blog
PCI Perspectives
PCI Perspectives
NISL@THU
NISL@THU
T
Troy Hunt's Blog
Project Zero
Project Zero
Y
Y Combinator Blog
阮一峰的网络日志
阮一峰的网络日志
G
GRAHAM CLULEY
小众软件
小众软件
月光博客
月光博客
Google DeepMind News
Google DeepMind News
W
WeLiveSecurity
C
Cisco Blogs
腾讯CDC
Blog — PlanetScale
Blog — PlanetScale
I
Intezer
I
InfoQ
WordPress大学
WordPress大学
F
Fortinet All Blogs
T
Threat Research - Cisco Blogs
N
News and Events Feed by Topic
T
Tor Project blog
N
News | PayPal Newsroom
A
Arctic Wolf
有赞技术团队
有赞技术团队
博客园 - Franky
Vercel News
Vercel News
宝玉的分享
宝玉的分享
Application and Cybersecurity Blog
Application and Cybersecurity Blog

博客园 - 秋天

sqlserver触发器 ASP.NET Core 性能对比评测(ASP.NET,Python,Java,NodeJS) URL地址中使用中文作为的参数【转】 百度地图API操作 js中对String去空格 [ASP.Net ]利用ashx搭建简易接口 使用RMS API 自定义Office(Word、Excel、PPT)加密策略 C#Excel文件加密实现,支持xlsx、docx、pptx(C#\Net\Asp.Net) - 秋天 - 博客园 使用vs2015搭建Asp.net Core 千万级规模高性能、高并发的网络架构经验分享 ASP.NET MVC学习系列(二)-WebAPI请求 浅谈HTTP中Get与Post的区别 ASP.NET MVC学习系列(一)-WebAPI初探 .net下web页生产一维条形码 微软源代码管理工具TFS2013安装与使用详细图文教程(Vs2013) Nginx搭建反向代理服务器过程详解 windows下安装nginx 我的架构设计~用层关系图说说mvc,mvvm,soa,ddd Ajax中Get请求与Post请求的区别
将String转化成Stream,将Stream转换成String
秋天 · 2016-04-18 · via 博客园 - 秋天

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

另:

String转换为byte数组用
byte[] arr = System.Text.Encoding.Default.GetBytes("abcde")

byte数组转换为String用:
string str = System.Text.Encoding.Default.GetString(arr);