G
Guest
Hello
Consider the following code
Stream s = File.Create(filename)
XmlTextWriter writer = new XmlTextWriter(s,encoding)
// write some elements ..
writer.Flush()
writer.Close()
s.Close()
After processing the file, I have to delete it
File.Delete(filename)
However, this throws an IOException (file in use probably). I'm almost sure that the stream or the writer still has a lock on the file. How can I force the file deletion
thx
Pieter
Consider the following code
Stream s = File.Create(filename)
XmlTextWriter writer = new XmlTextWriter(s,encoding)
// write some elements ..
writer.Flush()
writer.Close()
s.Close()
After processing the file, I have to delete it
File.Delete(filename)
However, this throws an IOException (file in use probably). I'm almost sure that the stream or the writer still has a lock on the file. How can I force the file deletion
thx
Pieter