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

MasterDetailEngine.ReadFile Method 

Read a file and return an array of the contained records.

[Visual Basic]
Public Function ReadFile( _
   ByVal fileName As String _
) As MasterDetails()
[C#]
public MasterDetails[] ReadFile(
   string fileName
);

Parameters

fileName
The file path to be read.

Return Value

An array of the records in the file

Remarks

This method open, read 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


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