小编Dav*_*son的帖子

C# File.ReadAllLines 不中断换行

我正在构建一个需要修改配置文件的应用程序。

我的问题是我无法逐行读取文件。我一直把整个文件作为一个字符串。

string ConfigTemplate = AEBuildsSPFolderName + "\\Template_BuildReleaseScript.Config";

string[] fileSourceLines = File.ReadAllLines(ConfigTemplate, Encoding.Default);
//Returns the entire file contents into the first array element.

using (StreamReader reader = new StreamReader(ConfigTemplate))
            {
                string line;
                while ((line = reader.ReadLine()) != null)
//Returns the entire file contents into the first line read.
Run Code Online (Sandbox Code Playgroud)

知道我做错了什么吗?

谢谢,

大卫

.net c# file-io

5
推荐指数
1
解决办法
2562
查看次数

标签 统计

.net ×1

c# ×1

file-io ×1