CsvWriter csvWriter = new CsvWriter(); //Trial Mode
//CsvWriter csvWriter = new CsvWriter("place user name here", "place license key here"); //License Mode
List<Person> persons = new List<Person>();
Person person1 = new Person();
person1.FirstName = "John";
person1.LastName = "Smith";
person1.BirthDate = DateTime.Now.AddYears(-6);
persons.Add(person1);
Person person2 = new Person();
person2.FirstName = "Sara";
person2.LastName = "Smith";
person2.BirthDate = DateTime.Now.AddYears(-4);
persons.Add(person2);
//Order the output by Last Name, First Name, Birth Date
List<string> propertyOrder = new List<string>();
propertyOrder.Add("LastName");
propertyOrder.Add("FirstName");
propertyOrder.Add("BirthDate");
string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testAppend.csv");
foreach (var person in persons)
{
csvWriter.AppendToCsvFile(person, filePath, propertyOrder);
}
Console.WriteLine(File.ReadAllText(filePath));