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 允许指定事件消息、事件的源、与事件关联的代码或标识符以及详细代码。

适用于