IOException Class
Definition
The exception that is thrown when an I/O error occurs.
[System.Runtime.InteropServices.ComVisible(true)]
public class IOException : SystemException
- Inheritance
- Derived
- Attributes
Inherited Members
System.Exception
System.Object
Examples
This code example is part of a larger example provided for the FileStream.Lock method.
// Catch the IOException generated if the
// specified part of the file is locked.
catch ( IOException^ e )
{
Console::WriteLine( "{0}: The write operation could not "
"be performed because the specified "
"part of the file is locked.", e->GetType()->Name );
}
// Catch the IOException generated if the
// specified part of the file is locked.
catch(IOException e)
{
Console.WriteLine(
"{0}: The write operation could not " +
"be performed because the specified " +
"part of the file is locked.",
e.GetType().Name);
}
' Catch the IOException generated if the
' specified part of the file is locked.
Catch ex As IOException
Console.WriteLine( _
"{0}: The write operation could " & _
"not be performed because the " & _
"specified part of the file is " & _
"locked.", ex.GetType().Name)
End Try
Remarks
IOException is the base class for exceptions thrown while accessing information using streams, files and directories.
The Base Class Library includes the following types, each of which is a derived class of IOException :
Where appropriate, use these types instead of IOException.
IOException uses the HRESULT COR_E_IO which has the value 0x80131620.
Constructors
| IOException() |
Initializes a new instance of the IOException class with its message string set to the empty string (""), its HRESULT set to COR_E_IO, and its inner exception set to a null reference. |
| IOException(String) |
Initializes a new instance of the IOException class with its message string set to |
| IOException(SerializationInfo, StreamingContext) |
Initializes a new instance of the IOException class with the specified serialization and context information. |
| IOException(String, Exception) |
Initializes a new instance of the IOException class with a specified error message and a reference to the inner exception that is the cause of this exception. |
| IOException(String, Int32) |
Initializes a new instance of the IOException class with its message string set to |