DriveNotFoundException Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the DriveNotFoundException class.
Overloads
DriveNotFoundException() |
Initializes a new instance of the DriveNotFoundException class with its message string set to a system-supplied message and its HRESULT set to COR_E_DIRECTORYNOTFOUND. |
DriveNotFoundException(String) |
Initializes a new instance of the DriveNotFoundException class with the specified message string and the HRESULT set to COR_E_DIRECTORYNOTFOUND. |
DriveNotFoundException(SerializationInfo, StreamingContext) |
Obsolete.
Initializes a new instance of the DriveNotFoundException class with the specified serialization and context information. |
DriveNotFoundException(String, Exception) |
Initializes a new instance of the DriveNotFoundException class with the specified error message and a reference to the inner exception that is the cause of this exception. |
DriveNotFoundException()
- Source:
- DriveNotFoundException.cs
- Source:
- DriveNotFoundException.cs
- Source:
- DriveNotFoundException.cs
Initializes a new instance of the DriveNotFoundException class with its message string set to a system-supplied message and its HRESULT set to COR_E_DIRECTORYNOTFOUND.
public:
DriveNotFoundException();
public DriveNotFoundException ();
Public Sub New ()
Remarks
This constructor initializes the Exception.Message property of the new instance to a system-supplied message that describes the error, such as "Could not find the specified directory." This message is localized based on the current system culture.
The Exception.InnerException property of the new instance is initialized to null
.
See also
- Exception
- Handling and Throwing Exceptions
- File and Stream I/O
- Reading Text from a File
- How to: Write Text to a File
Applies to
DriveNotFoundException(String)
- Source:
- DriveNotFoundException.cs
- Source:
- DriveNotFoundException.cs
- Source:
- DriveNotFoundException.cs
Initializes a new instance of the DriveNotFoundException class with the specified message string and the HRESULT set to COR_E_DIRECTORYNOTFOUND.
public:
DriveNotFoundException(System::String ^ message);
public DriveNotFoundException (string? message);
public DriveNotFoundException (string message);
new System.IO.DriveNotFoundException : string -> System.IO.DriveNotFoundException
Public Sub New (message As String)
Parameters
- message
- String
A String object that describes the error. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
Remarks
This constructor initializes the Exception.Message property of the new instance using the message
parameter.
The Exception.InnerException property of the new instance is initialized to null
.
See also
- Exception
- Handling and Throwing Exceptions
- File and Stream I/O
- Reading Text from a File
- How to: Write Text to a File
Applies to
DriveNotFoundException(SerializationInfo, StreamingContext)
- Source:
- DriveNotFoundException.cs
- Source:
- DriveNotFoundException.cs
- Source:
- DriveNotFoundException.cs
Caution
This API supports obsolete formatter-based serialization. It should not be called or extended by application code.
Initializes a new instance of the DriveNotFoundException class with the specified serialization and context information.
protected:
DriveNotFoundException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected DriveNotFoundException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected DriveNotFoundException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.IO.DriveNotFoundException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.IO.DriveNotFoundException
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.IO.DriveNotFoundException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.IO.DriveNotFoundException
Protected Sub New (info As SerializationInfo, context As StreamingContext)
Parameters
- info
- SerializationInfo
A SerializationInfo object that contains the serialized object data about the exception being thrown.
- context
- StreamingContext
A StreamingContext object that contains contextual information about the source or destination of the exception being thrown.
- Attributes
See also
- Exception
- Handling and Throwing Exceptions
- File and Stream I/O
- Reading Text from a File
- How to: Write Text to a File
Applies to
DriveNotFoundException(String, Exception)
- Source:
- DriveNotFoundException.cs
- Source:
- DriveNotFoundException.cs
- Source:
- DriveNotFoundException.cs
Initializes a new instance of the DriveNotFoundException class with the specified error message and a reference to the inner exception that is the cause of this exception.
public:
DriveNotFoundException(System::String ^ message, Exception ^ innerException);
public DriveNotFoundException (string? message, Exception? innerException);
public DriveNotFoundException (string message, Exception innerException);
new System.IO.DriveNotFoundException : string * Exception -> System.IO.DriveNotFoundException
Public Sub New (message As String, innerException As Exception)
Parameters
- message
- String
The error message that explains the reason for the exception.
- innerException
- Exception
The exception that is the cause of the current exception. If the innerException
parameter is not null
, the current exception is raised in a catch
block that handles the inner exception.
Remarks
An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the InnerException property. The InnerException property returns the same value that is passed into the constructor, or null
if the InnerException property does not supply the inner exception value to the constructor.
The following table shows the initial property values for an instance of DirectoryNotFoundException.
Property | Value |
---|---|
InnerException | The inner exception reference. |
Message | The error message string. |
See also
- Exception
- Handling and Throwing Exceptions
- File and Stream I/O
- Reading Text from a File
- How to: Write Text to a File