WebRequestErrorEvent 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 WebRequestErrorEvent 類別的新執行個體。
多載
WebRequestErrorEvent(String, Object, Int32, Exception) |
以指定的事件參數,初始化 WebRequestErrorEvent 類別。 |
WebRequestErrorEvent(String, Object, Int32, Int32, Exception) |
以指定的事件參數,初始化 WebRequestErrorEvent 類別。 |
備註
您用來定義事件碼或識別碼的值必須大於 WebExtendedBase 欄位常數。
WebRequestErrorEvent(String, Object, Int32, Exception)
以指定的事件參數,初始化 WebRequestErrorEvent 類別。
protected public:
WebRequestErrorEvent(System::String ^ message, System::Object ^ eventSource, int eventCode, Exception ^ exception);
protected internal WebRequestErrorEvent(string message, object eventSource, int eventCode, Exception exception);
new System.Web.Management.WebRequestErrorEvent : string * obj * int * Exception -> System.Web.Management.WebRequestErrorEvent
Protected Friend Sub New (message As String, eventSource As Object, eventCode As Integer, exception As Exception)
參數
- message
- String
事件描述。
- eventSource
- Object
做為事件來源的物件。
- eventCode
- Int32
與事件關聯的識別項。 它必須大於 WebExtendedBase 欄位常數。
範例
下列程式碼範例示範如何使用這個建構函式。
// Invoked in case of events
// identified only by their event code.
public SampleWebRequestErrorEvent(string msg,
object eventSource, int eventCode,
Exception e):
base(msg, eventSource, eventCode, e)
{
// Perform custom initialization.
eventInfo = new StringBuilder();
eventInfo.Append(string.Format(
"Event created at: ", 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, _
ByVal e As Exception)
MyBase.New(msg, eventSource, _
eventCode, e)
' Perform custom initialization.
eventInfo = New StringBuilder()
eventInfo.Append(String.Format( _
"Event created at: ", _
EventTime.ToString()))
End Sub
備註
此建 WebRequestErrorEvent 構函式可讓您建立事件,而不需要指定事件本身的詳細程式碼資訊。
適用於
WebRequestErrorEvent(String, Object, Int32, Int32, Exception)
以指定的事件參數,初始化 WebRequestErrorEvent 類別。
protected public:
WebRequestErrorEvent(System::String ^ message, System::Object ^ eventSource, int eventCode, int eventDetailCode, Exception ^ exception);
protected internal WebRequestErrorEvent(string message, object eventSource, int eventCode, int eventDetailCode, Exception exception);
new System.Web.Management.WebRequestErrorEvent : string * obj * int * int * Exception -> System.Web.Management.WebRequestErrorEvent
Protected Friend Sub New (message As String, eventSource As Object, eventCode As Integer, eventDetailCode As Integer, exception As Exception)
參數
- message
- String
事件描述。
- eventSource
- Object
做為事件來源的物件。
- eventCode
- Int32
與事件關聯的識別項。 它必須大於 WebExtendedBase 欄位常數。
- eventDetailCode
- Int32
事件詳細資料代碼識別項。
範例
下列程式碼範例示範如何使用這個建構函式。
// Invoked in case of events identified
// by their event code.and related event
// detailed code.
public SampleWebRequestErrorEvent(
string msg, object eventSource,
int eventCode, int detailedCode,
Exception e):
base(msg, eventSource,
eventCode, detailedCode, e)
{
// Perform custom initialization.
eventInfo = new StringBuilder();
eventInfo.Append(string.Format(
"Event created at: ", 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 detailedCode As Integer, _
ByVal e As Exception)
MyBase.New(msg, eventSource, _
eventCode, detailedCode, e)
' Perform custom initialization.
eventInfo = New StringBuilder()
eventInfo.Append(String.Format( _
"Event created at: ", _
EventTime.ToString()))
End Sub
備註
如果您需要指定事件的詳細程式碼資訊,請使用這個建構函式。