C# File.ReadAllLines not breaking on line feeds
Posted
by David Dickerson
on Stack Overflow
See other posts from Stack Overflow
or by David Dickerson
Published on 2010-05-06T01:46:57Z
Indexed on
2010/05/06
1:58 UTC
Read the original article
Hit count: 394
Hello,
I have an application that I am building that needs to modify a configuration file.
My problem is that I am not able to read the file in line by line. I keep geeting the the entire file as a single string.
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.
Any idea of what I am doing wrong?
Thanks,
david
© Stack Overflow or respective owner