如何使用 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#?
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章