Amazon Wish List News RSS feed. Development Blog Browse the Forums  
  Overview - Downloads - Examples - News Feed - Contact Info -

MasterDetailEngine.AppendToFile Method (String, MasterDetails[])

Append an array of records to the specified file.

[Visual Basic]
Overloads Public Sub AppendToFile( _
   ByVal fileName As String, _
   ByVal records As MasterDetails() _
)
[C#]
public void AppendToFile(
   string fileName,
   MasterDetails[] records
);

Parameters

fileName
The file path to be written at end.
records
The array of records to write.

Return Value

True if the operation is successful. False otherwise.

Remarks

This method open, seek ends, write and close the file (don't open or close the file before or after to call this method)

Example

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);

        

See Also

MasterDetailEngine Class | FileHelpers.MasterDetail Namespace | MasterDetailEngine.AppendToFile Overload List


Powered by:

Source Forge Thanks Jetbrains for support us !! Thanks BB Software for support us !! TestDriven.NET Code Coverage by Clover.NET Code Project Article Larkware News Sharp Toolbox