but how can we use append all line in 3.5
//4.5
string[] a = new string[] { fa + " "+ lastModified };
System.IO.File.AppendAllLines(filepath, a);
//3.5
string[] a = new string[] { fa + " "+ lastModified };
var ab = string.Join(Environment.NewLine, DataList.Select(x => x.blah blah blah).ToArray());
string outputFilePath = @"C:\output.txt";
File.AppendAllText(outputFilePath, ab);
public static void AppendAllLines(string path, IEnumerable
{
using (var writer = new StreamWriter(path, true))
foreach (var line in lines)
writer.WriteLine(line);
}

Manoj BhoirPosted May 26, 2015, 11:51 AM
How to Use :sachin JoshiPosted May 26, 2015, 9:25 AM
You can't use File.AppendAllLines() function in version prior to .NET 4.0. It only works in version 4.0 & above.
Instead what you can do is create a custom AppendAllLines() function easily to solve your problem. In the following sample code we are iterating through each line and appending them one by one to the file specified using "filePath" variable.
Example: