Write the specified number of records from the array to a file.
True if the operation is successful. False otherwise.
This method open, write and close the file (don't open or close the file before or after to call this method)
This method overrides existing files.
You need to define a Selector Method too:
RecordAction ExampleSelector(string record)
{
if (Char.IsLetter(record[0]))
return RecordAction.Master;
else
return RecordAction.Detail;
}
Finally you must to instanciate a MasterDetailEngine and Read/Write files: MaterDetailEngine engine = new MaterDetailEngine(typeof(Customers), typeof(Orders), new MasterDetailSelector(ExampleSelector));
// to Read use:
MasterDetail[] res = engine.ReadFile("TestIn.txt");
// to Write use:
engine.WriteFile("TestOut.txt", res);
MasterDetailEngine Class | FileHelpers.MasterDetail Namespace | MasterDetailEngine.WriteFile Overload List