共用方式為


Exception 類別

定義

表示應用程式執行期間發生的錯誤。

public ref class Exception
public ref class Exception : System::Runtime::Serialization::ISerializable
public ref class Exception : System::Runtime::InteropServices::_Exception, System::Runtime::Serialization::ISerializable
public class Exception
public class Exception : System.Runtime.Serialization.ISerializable
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDual)]
[System.Serializable]
public class Exception : System.Runtime.Serialization.ISerializable
[System.Serializable]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Runtime.InteropServices.ComVisible(true)]
public class Exception : System.Runtime.InteropServices._Exception, System.Runtime.Serialization.ISerializable
type Exception = class
type Exception = class
    interface ISerializable
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDual)>]
[<System.Serializable>]
type Exception = class
    interface ISerializable
[<System.Serializable>]
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type Exception = class
    interface ISerializable
    interface _Exception
Public Class Exception
Public Class Exception
Implements ISerializable
Public Class Exception
Implements _Exception, ISerializable
繼承
Exception
衍生
屬性
實作

備註

欲了解更多關於此 API 的資訊,請參閱 補充 API 例外說明

建構函式

名稱 Description
Exception()

初始化 Exception 類別的新執行個體。

Exception(SerializationInfo, StreamingContext)
已淘汰.

使用串行化數據,初始化 Exception 類別的新實例。

Exception(String, Exception)

初始化類別的新實例 Exception ,並附上指定的錯誤訊息及導致該異常的內部例外的參考。

Exception(String)

使用指定的錯誤訊息,初始化 Exception 類別的新實例。

屬性

名稱 Description
Data

取得索引鍵/值組的集合,提供例外狀況的其他使用者定義資訊。

HelpLink

取得或設定與這個例外狀況相關聯的說明檔連結。

HResult

取得或設定 HRESULT,這是指派給特定例外狀況的編碼數值。

InnerException

會取得 Exception 造成目前例外的實例。

Message

取得描述目前例外狀況的訊息。

Source

取得或設定造成錯誤之應用程式或物件的名稱。

StackTrace

取得呼叫堆疊上即時框架的字串表示。

TargetSite

取得擲回目前例外狀況的方法。

方法

名稱 Description
Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetBaseException()

當在派生類別中被覆寫時,回傳 Exception 是一個或多個後續例外的根因。

GetHashCode()

做為預設哈希函式。

(繼承來源 Object)
GetObjectData(SerializationInfo, StreamingContext)
已淘汰.

在衍生類別中覆寫時,使用例外狀況的相關信息來設定 SerializationInfo

GetType()

取得目前實例的運行時間類型。

GetType()

取得目前實例的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
ToString()

建立並傳回目前例外狀況的字串表示。

事件

名稱 Description
SerializeObjectState
已淘汰.

發生於例外狀況串行化以建立例外狀況狀態物件,其中包含例外狀況的串行化數據。

適用於

另請參閱