Home All Groups Group Topic Archive Search About

FileMode.CreateNew when file already exists

Author
5 Jan 2007 6:37 AM
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?

Author
5 Jan 2007 7:00 AM
doug mansell
doug mansell wrote:
> 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

AddThis Social Bookmark Button