共用方式為


WebBaseEvent 建構函式

定義

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

多載

WebBaseEvent(String, Object, Int32)

使用提供的參數來初始化 WebBaseEvent 類別的新執行個體。

WebBaseEvent(String, Object, Int32, Int32)

使用提供的參數來初始化 WebBaseEvent 類別的新執行個體。

WebBaseEvent(String, Object, Int32)

使用提供的參數來初始化 WebBaseEvent 類別的新執行個體。

protected public:
 WebBaseEvent(System::String ^ message, System::Object ^ eventSource, int eventCode);
protected internal WebBaseEvent (string message, object eventSource, int eventCode);
new System.Web.Management.WebBaseEvent : string * obj * int -> System.Web.Management.WebBaseEvent
Protected Friend Sub New (message As String, eventSource As Object, eventCode As Integer)

參數

message
String

事件的描述。

eventSource
Object

引發事件的物件。

eventCode
Int32

與事件關聯的代碼。 當您實作自訂事件時,事件代碼必須大於 WebExtendedBase

範例

下列程式碼範例示範如何使用這個建構函式。

// Invoked in case of events identified only by 
// their event code.
public SampleWebBaseEvent(string msg, 
    object eventSource, int eventCode):
  base(msg, eventSource, eventCode)
{
    // Perform custom initialization.
    customCreatedMsg =
    string.Format("Event created at: {0}",
    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)
    MyBase.New(msg, eventSource, eventCode)
    ' Perform custom initialization.
    customCreatedMsg = String.Format( _
    "Event created at: {0}", DateTime.Now.TimeOfDay.ToString())

End Sub

備註

此建構函式是由 ASP.NET 健全狀況監視系統在內部使用。 您永遠不會使用它來建立 類別的 WebBaseEvent 實例,但是當您實作繼承自這個類別的自有事件種類時,可以呼叫這個建構函式。

另請參閱

適用於

WebBaseEvent(String, Object, Int32, Int32)

使用提供的參數來初始化 WebBaseEvent 類別的新執行個體。

protected public:
 WebBaseEvent(System::String ^ message, System::Object ^ eventSource, int eventCode, int eventDetailCode);
protected internal WebBaseEvent (string message, object eventSource, int eventCode, int eventDetailCode);
new System.Web.Management.WebBaseEvent : string * obj * int * int -> System.Web.Management.WebBaseEvent
Protected Friend Sub New (message As String, eventSource As Object, eventCode As Integer, eventDetailCode As Integer)

參數

message
String

引發的事件之描述。

eventSource
Object

引發事件的物件。

eventCode
Int32

與事件關聯的代碼。 當您實作自訂事件時,事件代碼必須大於 WebExtendedBase

eventDetailCode
Int32

WebEventCodes 值,指定事件的詳細資料識別項。

範例

下列程式碼範例示範如何使用這個建構函式。

// Invoked in case of events identified by their 
// event code.and related event detailed code.
public SampleWebBaseEvent(string msg, object eventSource, 
    int eventCode, int eventDetailCode):
  base(msg, eventSource, eventCode, eventDetailCode)
{
    // Perform custom initialization.
    customCreatedMsg =
     string.Format("Event created at: {0}",
     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 eventDetailCode As Integer)
    MyBase.New(msg, eventSource, _
    eventCode, eventDetailCode)
    ' Perform custom initialization.
    customCreatedMsg = String.Format( _
    "Event created at: {0}", DateTime.Now.TimeOfDay.ToString())

End Sub

備註

此建構函式是由 ASP.NET 健全狀況監視系統在內部使用。 您永遠不會使用它來建立 類別的 WebBaseEvent 實例,但是當您實作繼承自這個類別的自有事件種類時,可以呼叫這個建構函式。

另請參閱

適用於