Read a file and return an array of the contained records.
An array of the records in the file
This method open, read and close the file (don't open or close the file before or after to call this method)
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