I'm using System.IO.File.Create to create a file. I'm not writing to it with a stream writer, just creating it.
I get a server error in the front end when the application tries to open the newly created file - that the file is in use. Garbage collection then seems to come along and a few minutes later all is OK.
Now I know if I was using Streamwriter I would have to close it. Does the same apply to creating?
I've read that opening a stream writer to the file then immediately closing it will fix this, but it seems messy. Is there a simpler way?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…