I would like to write string list items into a single line.At the moment when I do the write,it breaks the line with newline feeds with multiple lines.See section from code below:

List<String> stringList = new List<String>();

stringList.Add(line1);

while (line2 != null)
{
  if ( line1.Length >= 8 && line2.Length >= 8 && line1.Substring(0,8) == line2.Substring(0,8) )
  {
    stringList.Add(line2);
  }
  line2 = fileread2.ReadLine();
  counter2++;
}
// string outcome = string.Join(",", stringList);
filewrite.WriteLine( stringList.Aggregate((current,next) => string.Format("{0}, {1}", current, next)));

The code above includes a streamreader and streamwritwer.
The input is 200mb text file.The output is also a text file, but my intetion is to make it display grouped data per line.The problem is the line is too long,so it gets displayed with newline feeds. i need it displayed as single line per group on notepad txt regardless of how long it is,instead of multiple lines.i have tried join,concatenate,array but still not working. Please Advise.

If I'm not mistaken , you are using WriteLine instead of just Write .
Your goal is actually just to write everything in a single line?

Yes,to write as one continous line.i also tried Write but that did not do the trick either.

Hmm.... maybe in Notepad Wordwrap (under Format) is set?

Thanks guys i found the solution,apparently notepad does not support lines longer than 1024 characters.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.