WebErrorEvent 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 WebErrorEvent 類別的新執行個體。
多載
| 名稱 | Description |
|---|---|
| WebErrorEvent(String, Object, Int32, Exception) |
使用提供的參數初始化類別 WebErrorEvent 。 |
| WebErrorEvent(String, Object, Int32, Int32, Exception) |
使用所提供的參數初始化該類別的新實例 WebErrorEvent 。 |
WebErrorEvent(String, Object, Int32, Exception)
使用提供的參數初始化類別 WebErrorEvent 。
protected public:
WebErrorEvent(System::String ^ message, System::Object ^ eventSource, int eventCode, Exception ^ exception);
protected internal WebErrorEvent(string message, object eventSource, int eventCode, Exception exception);
new System.Web.Management.WebErrorEvent : string * obj * int * Exception -> System.Web.Management.WebErrorEvent
Protected Friend Sub New (message As String, eventSource As Object, eventCode As Integer, exception As Exception)
參數
- message
- String
事件說明。
- eventSource
- Object
事件的來源物體。
- eventCode
- Int32
與該事件相關的代碼。 當你實作自訂事件時,事件碼必須大於 WebExtendedBase。
範例
以下程式碼範例說明如何自訂此建構子。
// Invoked in case of events identified
// only by their event code.
public SampleWebErrorEvent(string msg,
object eventSource, int eventCode, Exception e)
:
base(msg, eventSource, eventCode, e)
{
// Perform custom initialization.
eventInfo = new StringBuilder();
eventInfo.Append(string.Format(
"Event created at: ", EventTime.ToString()));
}
' Invoked in case of events identified
' only by their event code.
Public Sub New(ByVal msg As String, _
ByVal eventSource As Object, _
ByVal eventCode As Integer, ByVal e As Exception)
MyBase.New(msg, eventSource, eventCode, e)
' Perform custom initialization.
eventInfo = New StringBuilder()
eventInfo.Append(String.Format( _
"Event created at: ", EventTime.ToString()))
End Sub
備註
建 WebErrorEvent 構子並非直接從你的程式碼中使用。 它被稱為 ASP.NET。 你可以在從WebErrorEvent類別推導時呼叫建WebErrorEvent構子。
另請參閱
適用於
WebErrorEvent(String, Object, Int32, Int32, Exception)
使用所提供的參數初始化該類別的新實例 WebErrorEvent 。
protected public:
WebErrorEvent(System::String ^ message, System::Object ^ eventSource, int eventCode, int eventDetailCode, Exception ^ exception);
protected internal WebErrorEvent(string message, object eventSource, int eventCode, int eventDetailCode, Exception exception);
new System.Web.Management.WebErrorEvent : string * obj * int * int * Exception -> System.Web.Management.WebErrorEvent
Protected Friend Sub New (message As String, eventSource As Object, eventCode As Integer, eventDetailCode As Integer, exception As Exception)
參數
- message
- String
事件說明。
- eventSource
- Object
事件的來源物體。
- eventCode
- Int32
與該事件相關的代碼。 當你實作自訂事件時,事件碼必須大於 WebExtendedBase。
- eventDetailCode
- Int32
指定 WebEventCodes 事件詳細識別碼的值。
範例
以下程式碼範例說明如何從 WebErrorEvent 類別衍生出自訂事件。
// Invoked in case of events identified
// by their event code.and
// related event detailed code.
public SampleWebErrorEvent(string msg,
object eventSource, int eventCode,
int detailedCode, Exception e):
base(msg, eventSource,
eventCode, detailedCode, e)
{
// Perform custom initialization.
eventInfo = new StringBuilder();
eventInfo.Append(string.Format(
"Event created at: ", EventTime.ToString()));
}
' Invoked in case of events identified
' by their event code.and
' related event detailed code.
Public Sub New(ByVal msg As String, ByVal eventSource _
As Object, ByVal eventCode As Integer, _
ByVal detailedCode As Integer, ByVal e As Exception)
MyBase.New(msg, eventSource, _
eventCode, detailedCode, e)
' Perform custom initialization.
eventInfo = New StringBuilder()
eventInfo.Append(String.Format( _
"Event created at: ", EventTime.ToString()))
End Sub
備註
建 WebErrorEvent 構子並非直接從你的程式碼中使用。 它被稱為 ASP.NET。 你可以在從WebErrorEvent類別推導時呼叫建WebErrorEvent構子。