public class IOException : SystemException
Object
Exception
SystemException
IOException
mscorlib
BCL
Represents the error that occurs when an I/O operation fails.
IOException is the base class for exceptions thrown while accessing information using streams, files and directories.[Note: The Base Class Library includes the following types, each of which is derived from IOException:
Where appropriate, use these types instead of IOException.
- DirectoryNotFoundException
- EndOfStreamException
- FileLoadException
- FileNotFoundException
- PathTooLongException
]
System.IO Namespace
IOException Constructors
IOException() Constructor
IOException(System.String) Constructor
IOException(System.String, System.Exception) Constructor
public IOException();
Constructs and initializes a new instance of the IOException class.
The constructor initializes the System.IO.IOException.Message property of the new instance to a system-supplied message that describes the error, such as "An I/O error occurred while performing the requested operation." This message takes into account the current system culture.The System.IO.IOException.InnerException property of the new instance is initialized to
null
.
System.IO.IOException Class, System.IO Namespace
public IOException(string message);
Constructs and initializes a new instance of the IOException class.
- message
- A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
The constructor initializes the System.IO.IOException.Message property of the new instance using message. If message isnull
, the System.IO.IOException.Message property is initialized to a system-supplied message.The System.IO.IOException.InnerException property of the new instance is initialized to
null
.
System.IO.IOException Class, System.IO Namespace
public IOException(string message, Exception innerException);
Constructs and initializes a new instance of the IOException class.
- message
- A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
- innerException
- An instance of Exception that is the cause of the current exception. If innerException is non-null, then the current Exception was raised in a catch block handling innerException.
The constructor initializes the System.IO.IOException.Message property of the new instance using message and the System.IO.IOException.InnerException property using innerException. If message isnull
, the System.IO.IOException.Message property is initialized to a system-supplied message.[Note: For more information on inner exceptions, see System.Exception.InnerException.]
System.IO.IOException Class, System.IO Namespace