WebBaseEvent 构造函数

定义

初始化 WebBaseEvent 类的新实例。Initializes a new instance of the WebBaseEvent class.

重载

WebBaseEvent(String, Object, Int32)

使用所提供的参数初始化 WebBaseEvent 类的新实例。Initializes a new instance of the WebBaseEvent class using the supplied parameters.

WebBaseEvent(String, Object, Int32, Int32)

使用所提供的参数初始化 WebBaseEvent 类的新实例。Initializes a new instance of the WebBaseEvent class using the supplied parameters.

WebBaseEvent(String, Object, Int32)

使用所提供的参数初始化 WebBaseEvent 类的新实例。Initializes a new instance of the WebBaseEvent class using the supplied parameters.

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

事件的说明。The description of the event.

eventSource
Object

引发事件的对象。The object that raised the event.

eventCode
Int32

与该事件关联的代码。The code associated with the event. 实现自定义事件时,事件代码必须大于 WebExtendedBaseWhen you implement a custom event, the event code must be greater than WebExtendedBase.

示例

下面的代码示例演示如何使用此构造函数。The following code example shows how to use this constructor.

// 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 health 监视系统在内部使用。This constructor is used internally by the ASP.NET health-monitoring system. 你永远不会使用它来创建类的实例 WebBaseEvent ,但可以在实现继承自此类的事件类型时调用此构造函数。You will never use it to create an instance of the WebBaseEvent class, but you can call this constructor when you implement your own event type that inherits from this class.

另请参阅

适用于

WebBaseEvent(String, Object, Int32, Int32)

使用所提供的参数初始化 WebBaseEvent 类的新实例。Initializes a new instance of the WebBaseEvent class using the supplied parameters.

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

引发的事件的说明。The description of the raised event.

eventSource
Object

引发事件的对象。The object that raised the event.

eventCode
Int32

与该事件关联的代码。The code associated with the event. 实现自定义事件时,事件代码必须大于 WebExtendedBaseWhen you implement a custom event, the event code must be greater than WebExtendedBase.

eventDetailCode
Int32

用于指定事件的详细标识符的 WebEventCodes 值。The WebEventCodes value that specifies the detailed identifier for the event.

示例

下面的代码示例演示如何使用此构造函数。The following code example shows how to use this constructor.

// 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 health 监视系统在内部使用。This constructor is used internally by the ASP.NET health-monitoring system. 你永远不会使用它来创建类的实例 WebBaseEvent ,但可以在实现继承自此类的事件类型时调用此构造函数。You will never use it to create an instance of the WebBaseEvent class, but you can call this constructor when you implement your own event type that inherits from this class.

另请参阅

适用于