Dear all,
I have kinda general question, but as long as I will need ideas that to
implement in C#, I will dare to ask.
I have made a custom database file format to use in my application. The data
is saved to the file using something like this :
FileStream fs = new FileStream( this.path, FileMode.OpenOrCreate,
FileAccess.ReadWrite ) ;
byte[] header = ConstructHeaderBytes() ;
fs.Write( header, header.Length ) ;
And whenever the user wants to add a record to the file I do like these :
byte[] data = ConstructRecordBytes( myRecord ) ;
int seekPlace = AFTERHEADER +
fs.Seek ( fs.Length, SeekOrigin.Begin ) ;
So, I am able to seek and update in any place in the file. Now, after I
finish all general stuff. I want to be able to provide a real database-like
functionality.
My questions are:
1- Do you think that it is efficient to do my custom database using the File
Streamer ( converting all objects to/from binary data )?
2- How do you think should I implement the following: Sorting, Eliminating
Duplicates for exisiting saved files.
Specially For the second question I would really appreciate any suggestions.