I am trying to write data files to disk so that I can cache large amounts of data that won't fit into memory. In some early tests I find that sometimes I get data written and sometimes not. Here is a sample that shows the process not working:
using System.IO;
using System;
namespace TestBinaryWriter
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
double dFoo = 1234.1234;
BinaryWriter bw = new BinaryWriter(File.OpenWrite("asdf"));
bw.Write(dFoo);
bw.Write(BitConverter.GetBytes(dFoo));
}
}
}
The contents of file 'asdf' are empty and I don't understand why.