Say I want to define a TempFileStream class that creates a temporary file using Path.GetTempFileName() method. A temporary file must be deleted when TempFileStream\'s object
base.Dispose(disposing); // disposes the base stream so the file is no longer used if (disposing) File.Delete(m_TempFileName); // deletes the file
You should add proper exception handling for File.Delete if you need to.