FileMode.CreateNew when file already exists

  • Thread starter Thread starter doug mansell
  • Start date Start date
D

doug mansell

If I use System.IO.File.Open with FileMode.CreateNew, and the file
already exists I get an IOException. Ok... but there is no specific
exception for "file already exists", so how do I determine
programatically that that was indeed the cause?
 
doug said:
If I use System.IO.File.Open with FileMode.CreateNew, and the file
already exists I get an IOException. Ok... but there is no specific
exception for "file already exists", so how do I determine
programatically that that was indeed the cause?

oh silly me...

System.Runtime.InteropServices.Marshal.GetHRForException
 
Back
Top