I using C# .NET , vs 2008 , .net 3.5
For me, is difficult, but I need sample code in C# for this:
- How get the error code of IOException "The process cannot access the file 'XYZ' because it is being used by another process."
For example, in my issue.
I try delete file, and I get "The process cannot access the file 'XYZ' because it is being used by another process." Exception.
try
{
File.Delete(infoFichero.Ruta);
}
catch (IOException ex)
{
// ex.Message == "The process cannot access the file 'XYZ' because it is being used by another process."
}
But if .NET is Spanish, I get "El proceso no puede obtener acceso al archivo '00000004.PDF' porque está siendo utilizado en otro" message.
System.IO.IOException: El proceso no puede obtener acceso al archivo '00000004.PDF' porque está siendo utilizado en otro proceso.
en System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
en System.IO.FileInfo.Delete()
I need a ERROR CODE for that Exception. In Trace, I have seen System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
How get the error code of IOException "The process cannot access the file 'XYZ' because it is being used by another process."
Please, any sample code, I ask for help gurus, MVPs, anyone...