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

MasterDetailEngine.WriteStream Method (TextWriter, MasterDetails[], Int32)

Write the specified number of records in the array to the Stream.

[Visual Basic]
Overloads Public Sub WriteStream( _
   ByVal writer As TextWriter, _
   ByVal records As MasterDetails(), _
   ByVal maxRecords As Integer _
)
[C#]
public void WriteStream(
   TextWriter writer,
   MasterDetails[] records,
   int maxRecords
);

Parameters

writer
The writer of the source stream.
records
The array of records to write.
maxRecords
The max number of array elements to write.

Return Value

True if the operation is successful. False otherwise.

Remarks

This method only uses the stream and don't close them after use it, you must do it.

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.WriteStream 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