This is by far not a nice approach to data storage. The problem is not the binary representation of data itself, but it's ad-hoc and non-flexible nature.
Anyway, you need to use the classes
Basically, you would need to read and write the structure by component:
BinaryReader reader = new BinaryReader();
eRecord myRecord =
myRecord.fName = reader.ReadString();
myRecord.lName = reader.ReadString();
myRecord.dep = reader.ReadString();
I don't know how you represented the date, so chances are, you would need to bread date into some primitive-type components like some integer types and read the one-by-one, using
or the like. You can check with some binary editor to see its binary structure or figure out from original code.
Writing is done in the same way with
, symmetrical to reading.
Next time, don't do such things. Learn serialization instead:
First of all, as a very easy-to-use, robust and universal approach to serialization, consider using Data Contracts