如何使用c#从notpad读取所有文本到字符串 [英] How to read all text from a notpad to a string using c#

查看:66
本文介绍了如何使用c#从notpad读取所有文本到字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要读取.txt文件中的所有值到字符串,

提前谢谢。

I need to read all the values from a .txt file to a string,
Thanks in advance.

推荐答案

你可以只需执行以下操作

you can simply do as below
string readText = File.ReadAllText(path);



阅读 File.ReadAllText Method [ ^ ]


让我谷歌为你服务 [ ^ ]


你可以使用

File.ReadAllLines(filePath);



查看此链接

http:/ /msdn.microsoft.com/en-us/library/s2tte0y1%28 v = vs.110%29.aspx [ ^ ]


这篇关于如何使用c#从notpad读取所有文本到字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆