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.