WebApplicationLifetimeEvent 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 WebApplicationLifetimeEvent 類別的新執行個體。
多載
| 名稱 | Description |
|---|---|
| WebApplicationLifetimeEvent(String, Object, Int32) |
使用提供的參數初始化類別 WebApplicationLifetimeEvent 。 |
| WebApplicationLifetimeEvent(String, Object, Int32, Int32) |
使用提供的參數初始化類別 WebApplicationLifetimeEvent 。 |
WebApplicationLifetimeEvent(String, Object, Int32)
使用提供的參數初始化類別 WebApplicationLifetimeEvent 。
protected public:
WebApplicationLifetimeEvent(System::String ^ message, System::Object ^ eventSource, int eventCode);
protected internal WebApplicationLifetimeEvent(string message, object eventSource, int eventCode);
new System.Web.Management.WebApplicationLifetimeEvent : string * obj * int -> System.Web.Management.WebApplicationLifetimeEvent
Protected Friend Sub New (message As String, eventSource As Object, eventCode As Integer)
參數
- message
- String
與該活動相關的訊息。
- eventSource
- Object
事件的來源物體。
- eventCode
- Int32
與該事件相關的代碼。 當你實作自訂事件時,事件碼必須大於 WebExtendedBase。
範例
以下程式碼範例展示了如何在 ASP.NET 自訂健康事件中使用 WebApplicationLifetimeEvent。 此程式碼範例主要用來展示正確的語法。
// Invoked in case of events identified only by
// their event code.
public SampleWebApplicationLifetimeEvent(string msg,
object eventSource, int eventCode):
base(msg, eventSource, eventCode)
{
// Perform custom initialization.
customCreatedMsg =
string.Format("Event created at: {0}",
DateTime.Now.TimeOfDay.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 健康監控系統內部使用。 你永遠不會用它來建立該類別的實例 WebApplicationLifetimeEvent ,但你可以在實作繼承自該類別的事件型態時呼叫這個建構子。
Note
建 WebApplicationLifetimeEvent 構子並非直接從你的程式碼中使用。 它被稱為 ASP.NET。 你可以在從WebApplicationLifetimeEvent類別推導時呼叫建WebApplicationLifetimeEvent構子。
另請參閱
適用於
WebApplicationLifetimeEvent(String, Object, Int32, Int32)
使用提供的參數初始化類別 WebApplicationLifetimeEvent 。
protected public:
WebApplicationLifetimeEvent(System::String ^ message, System::Object ^ eventSource, int eventCode, int eventDetailCode);
protected internal WebApplicationLifetimeEvent(string message, object eventSource, int eventCode, int eventDetailCode);
new System.Web.Management.WebApplicationLifetimeEvent : string * obj * int * int -> System.Web.Management.WebApplicationLifetimeEvent
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 事件詳細識別碼的值。
範例
以下程式碼範例展示了如何在 ASP.NET 自訂健康事件中使用 WebApplicationLifetimeEvent。 此程式碼範例主要用來展示正確的語法。
// Invoked in case of events identified by their
// event code.and related event detailed code.
public SampleWebApplicationLifetimeEvent(string msg,
object eventSource, int eventCode,
int eventDetailCode):
base(msg, eventSource, eventCode, eventDetailCode)
{
// Perform custom initialization.
customCreatedMsg =
string.Format("Event created at: {0}",
DateTime.Now.TimeOfDay.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 健康監控系統內部使用。 你永遠不會用它來建立該類別的實例 WebApplicationLifetimeEvent ,但你可以在實作繼承自該類別的事件型態時呼叫這個建構子。
Note
建 WebApplicationLifetimeEvent 構子並非直接從你的程式碼中使用。 它被稱為 ASP.NET。 你可以在從WebApplicationLifetimeEvent類別推導時呼叫建WebApplicationLifetimeEvent構子。