Create a
FileStream
, attach a
BinaryWriter
to it, and serialize data using the various
BinaryWriter.Write()
overloads. Here's an example of the top of my head:
int i = 123;
string s = "Hello";
double d = 1.23456;
using (FileStream fs = new FileStream (@"C:\foo.dat", FileMode.CreateNew)) {
using (BinaryWriter bw = new BinaryWriter (fs) {
bw.Write (i);
bw.Write (s);
bw.Write (d);
}
}
/ravi