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 实例,但可以在实现自己的从此类继承的事件类型时调用此构造函数。

另请参阅

适用于