tags:

views:

98

answers:

2

I need to read/write file which as light as possible and with super-fast read and write access. In other words, I cannot use serialization or binary serialization. I have to be able to update a single records and seek in the file quickly.

Essentially, I need a file structure similar to what I would do in C/C++ (i.e. fixed size structure with a defined size that I can read/write on the file and allow me to seek in it). Any idea how to do that in C#?

A: 

I posted a question about this a while ago....and its answered... :D

tommieb75
+1  A: 

There is no reason you can't just use the FileStream or more generally the Stream class to accomplish this goal. Both of these classes support seeking and reading the raw data from a file without any serialization necessary. Is there a reason this doesn't work for your scenario?

JaredPar
I have a struct with a couple of int, long, double, and date. I want to be able to open the file and seek at the exact position of the 100th record. Would it be possible with the FileStream? If so, how?
Martin