I am pretty depressed by my programming knowledge but do we really need to dispose FileStream Object ?
Reason I am asking is because code is throwing \"File being us
If a class implements IDisposable, then you should dispose it so any resources gets closed/cleaned up asap instead of relying on the garbage collector. Better yet, wrap it in a using block so it gets closed even if an exception occurs.
using (var stream = new FileStream(...))
{
// do stuff with stream
}