LoginSignup
4
2

More than 5 years have passed since last update.

IO.File.Create のあとの処理でIO.Exceptionが発生するのを回避する (.NET)

Posted at

IO.File.Create("ファイル") でファイル作成したあと、作成したファイルにアクセスすると、IO.Exceptionエラーが発生し、「別のプロセスで使用されているため、プロセスはファイル ‘ファイル’ にアクセスできません。」と怒られた。

IO.File.Create("ファイル") ではファイルが開いたままになるので、閉じる必要がある。

IO.File.Create("ファイル").Close()

これで閉じられる。
C#でも同じ。

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2