The process cannot access the file '...' because it is being used by another process
<p>I searched alot about this Exception's solutions but without any result yet.
This is my code,
The exception is being thrown at the line:</p>

<pre><code> BinaryWriter BW = new BinaryWriter(FI.Open(FileMode.Open));
</code></pre>

<p>Note that the exception doesn't raise every time.. I know that this is strange.
Any one have an idea?</p>

<pre><code>    FileInfo FI = new FileInfo("e:\\cc.accdb");
    if (FI.Exists)
        FI.Delete();

    GC.Collect();

    FI.Create();

    byte[] bb = { 54, 87, 98, 57, 65 };
    BinaryWriter BW = new BinaryWriter(FI.Open(FileMode.Open));
    BW.Write(bb);
</code></pre>
