DriveNotFoundException 建構函式

定義

初始化 DriveNotFoundException 類別的新執行個體。Initializes a new instance of the DriveNotFoundException class.

多載

DriveNotFoundException()

將其訊息字串設定為系統提供的訊息且將其 HRESULT 設定為 COR_E_DIRECTORYNOTFOUND,初始化 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)

使用指定的訊息字串和設為 COR_E_DIRECTORYNOTFOUND 的 HRESULT,初始化 DriveNotFoundException 類別的新執行個體。Initializes a new instance of the DriveNotFoundException class with the specified message string and the HRESULT set to COR_E_DIRECTORYNOTFOUND.

DriveNotFoundException(SerializationInfo, StreamingContext)

使用指定的序列化及內容資訊,初始化 DriveNotFoundException 類別的新執行個體。Initializes a new instance of the DriveNotFoundException class with the specified serialization and context information.

DriveNotFoundException(String, Exception)

初始化具有指定的錯誤訊息以及造成此例外狀況的內部例外狀況參考之 DriveNotFoundException 類別的新執行個體。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()

將其訊息字串設定為系統提供的訊息且將其 HRESULT 設定為 COR_E_DIRECTORYNOTFOUND,初始化 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.

public:
 DriveNotFoundException();
public DriveNotFoundException ();
Public Sub New ()

備註

此函式會將新實例的 Exception.Message 屬性初始化為描述錯誤的系統提供訊息,例如「找不到指定的目錄」。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.

新實例的 Exception.InnerException 屬性會初始化為 nullThe Exception.InnerException property of the new instance is initialized to null.

另請參閱

DriveNotFoundException(String)

使用指定的訊息字串和設為 COR_E_DIRECTORYNOTFOUND 的 HRESULT,初始化 DriveNotFoundException 類別的新執行個體。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);
new System.IO.DriveNotFoundException : string -> System.IO.DriveNotFoundException
Public Sub New (message As String)

參數

message
String

描述錯誤的 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.

備註

這個建構函式使用 Exception.Message 參數來初始化新執行個體的 message 屬性。This constructor initializes the Exception.Message property of the new instance using the message parameter.

新實例的 Exception.InnerException 屬性會初始化為 nullThe Exception.InnerException property of the new instance is initialized to null.

另請參閱

DriveNotFoundException(SerializationInfo, StreamingContext)

使用指定的序列化及內容資訊,初始化 DriveNotFoundException 類別的新執行個體。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);
new System.IO.DriveNotFoundException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.IO.DriveNotFoundException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

參數

info
SerializationInfo

SerializationInfo 物件,包含關於擲回例外狀況的序列化物件資料。A SerializationInfo object that contains the serialized object data about the exception being thrown.

context
StreamingContext

StreamingContext 物件,包含關於擲回例外狀況之來源或目的端的內容資訊。A StreamingContext object that contains contextual information about the source or destination of the exception being thrown.

另請參閱

DriveNotFoundException(String, Exception)

初始化具有指定的錯誤訊息以及造成此例外狀況的內部例外狀況參考之 DriveNotFoundException 類別的新執行個體。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);
new System.IO.DriveNotFoundException : string * Exception -> System.IO.DriveNotFoundException
Public Sub New (message As String, innerException As Exception)

參數

message
String

說明例外狀況原因的錯誤訊息。The error message that explains the reason for the exception.

innerException
Exception

造成目前例外狀況的例外狀況。The exception that is the cause of the current exception. 如果 innerException 參數不是 null,則目前的例外狀況會在處理內部例外的 catch 區塊中引發。If the innerException parameter is not null, the current exception is raised in a catch block that handles the inner exception.

備註

當作先前例外狀況直接結果擲回的例外狀況應在 InnerException 屬性中包含先前例外狀況的參考。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. InnerException 屬性傳回的值會與傳入建構函式的值相同,或傳回 null (如果 InnerException 屬性未提供內部例外狀況值給建構函式)。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.

下表顯示 DirectoryNotFoundException 執行個體的初始屬性值。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.

另請參閱

適用於