Share via


WebRequestEvent 建構函式

定義

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

多載

WebRequestEvent(String, Object, Int32)

以指定的事件參數,初始化 WebRequestEvent 類別。

WebRequestEvent(String, Object, Int32, Int32)

以指定的事件參數,初始化 WebRequestEvent 類別。

WebRequestEvent(String, Object, Int32)

以指定的事件參數,初始化 WebRequestEvent 類別。

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

參數

message
String

與事件關聯的訊息。

eventSource
Object

做為事件來源的物件。

eventCode
Int32

與事件關聯的 WebEventCodes 代碼。 它必須大於 WebExtendedBase

範例

下列程式碼範例示範如何自訂此建構函式。

注意

您用來定義事件程式碼或識別碼的值必須大於 WebExtendedBase

// Invoked in case of events identified only 
// by their event code.
public SampleWebRequestEvent(
    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}", _
    EventTime.ToString())

End Sub

備註

建構 WebRequestEvent 函式允許指定事件訊息、事件的來源,以及與事件相關聯的程式碼或識別碼。

適用於

WebRequestEvent(String, Object, Int32, Int32)

以指定的事件參數,初始化 WebRequestEvent 類別。

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

參數

message
String

與事件關聯的訊息。

eventSource
Object

做為事件來源的物件。

eventCode
Int32

與事件關聯的 WebEventCodes 代碼。 它必須大於 WebExtendedBase

eventDetailCode
Int32

與事件關聯的 WebEventCodes 詳細資料代碼。

範例

下列程式碼範例示範如何自訂此建構函式。

注意

您用來定義事件碼或識別碼的值必須大於 WebExtendedBase

// Invoked in case of events identified 
// by their event code.and 
// related event detailed code.
public SampleWebRequestEvent(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}", _
    EventTime.ToString())

End Sub

備註

建構 WebRequestEvent 函式允許指定事件訊息、事件的來源、與事件相關聯的程式碼或識別碼,以及詳細的程式碼。

適用於