MultiRecordEngineWriteFile Method (String, IEnumerable) |
Namespace: FileHelpers
This method opens, writes and closes the file (don't open or close the file before or after calling this method)
This method over writes existing files.
using FileHelpers; // First declare the record class [Delimitedrecord("|")] public class SampleType { public string Field1; public int Field2; } public void WriteExample() { var engine = new FileHelperEngine<SampleType>(); SampleType[] records = new SampleType[1]; records[0] = new SampleType(); records[0].Field1 = "Hello World"; records[0].Field2 = 12; engine.WriteFile("destination.txt", records); // Now the file contains the created record in this format: // // Hello World,12 }