如何使用 C# 将整个文件读取为字符串? - How to read an entire file to a string using C#?

问题:

What is the quickest way to read a text file into a string variable?将文本文件读入字符串变量的最快方法是什么?

I understand it can be done in several ways, such as read individual bytes and then convert those to string.我知道它可以通过多种方式完成,例如读取单个字节,然后将它们转换为字符串。 I was looking for a method with minimal coding.我正在寻找一种编码最少的方法。


解决方案:

参考一: https://stackoom.com/question/UziX
参考二: How to read an entire file to a string using C#?
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章