EventSource.Write 方法

定義

寫入事件。

多載

Write(String)

寫入不含欄位,但具有指定名稱和預設選項的事件。

Write(String, EventSourceOptions)

寫入不含欄位,但具有指定名稱和選項的事件。

Write<T>(String, T)

寫入具有指定名稱和資料的事件。

Write<T>(String, EventSourceOptions, T)

寫入具有指定名稱、事件資料和選項的事件。

Write<T>(String, EventSourceOptions, T)

寫入具有指定名稱、選項和事件資料的事件。

Write<T>(String, EventSourceOptions, Guid, Guid, T)

寫入具有指定名稱、選項、相關活動和事件資料的事件。

Write(String)

來源:
TraceLoggingEventSource.cs
來源:
TraceLoggingEventSource.cs
來源:
TraceLoggingEventSource.cs

寫入不含欄位,但具有指定名稱和預設選項的事件。

public:
 void Write(System::String ^ eventName);
public void Write (string eventName);
public void Write (string? eventName);
member this.Write : string -> unit
Public Sub Write (eventName As String)

參數

eventName
String

要寫入的事件名稱。

例外狀況

eventNamenull

適用於

Write(String, EventSourceOptions)

來源:
TraceLoggingEventSource.cs
來源:
TraceLoggingEventSource.cs
來源:
TraceLoggingEventSource.cs

寫入不含欄位,但具有指定名稱和選項的事件。

public:
 void Write(System::String ^ eventName, System::Diagnostics::Tracing::EventSourceOptions options);
public void Write (string eventName, System.Diagnostics.Tracing.EventSourceOptions options);
public void Write (string? eventName, System.Diagnostics.Tracing.EventSourceOptions options);
member this.Write : string * System.Diagnostics.Tracing.EventSourceOptions -> unit
Public Sub Write (eventName As String, options As EventSourceOptions)

參數

eventName
String

要寫入的事件名稱。

options
EventSourceOptions

事件的層級、關鍵字和作業程式碼等選項。

例外狀況

eventNamenull

適用於

Write<T>(String, T)

來源:
TraceLoggingEventSource.cs
來源:
TraceLoggingEventSource.cs
來源:
TraceLoggingEventSource.cs

寫入具有指定名稱和資料的事件。

public:
generic <typename T>
 void Write(System::String ^ eventName, T data);
public void Write<T> (string eventName, T data);
public void Write<T> (string? eventName, T data);
member this.Write : string * 'T -> unit
Public Sub Write(Of T) (eventName As String, data As T)

類型參數

T

定義事件的類型及其相關聯的資料。 此類型必須為匿名類型,或必須具有 EventSourceAttribute 屬性標記。

參數

eventName
String

事件的名稱。

data
T

事件資料。 此類型必須為匿名類型,或必須具有 EventDataAttribute 屬性標記。

備註

如果 為 eventNamenull,則事件名稱會自動衍生自類型 T 的事件數據, (Name) 或根據類型 T的名稱決定。 的 data 公用實例屬性會以遞歸方式寫入,以建立事件欄位。

適用於

Write<T>(String, EventSourceOptions, T)

來源:
TraceLoggingEventSource.cs
來源:
TraceLoggingEventSource.cs
來源:
TraceLoggingEventSource.cs

寫入具有指定名稱、事件資料和選項的事件。

public:
generic <typename T>
 void Write(System::String ^ eventName, System::Diagnostics::Tracing::EventSourceOptions options, T data);
public void Write<T> (string eventName, System.Diagnostics.Tracing.EventSourceOptions options, T data);
public void Write<T> (string? eventName, System.Diagnostics.Tracing.EventSourceOptions options, T data);
member this.Write : string * System.Diagnostics.Tracing.EventSourceOptions * 'T -> unit
Public Sub Write(Of T) (eventName As String, options As EventSourceOptions, data As T)

類型參數

T

定義事件的類型及其相關聯的資料。 此類型必須為匿名類型,或必須具有 EventSourceAttribute 屬性標記。

參數

eventName
String

事件的名稱。

options
EventSourceOptions

事件選項。

data
T

事件資料。 此類型必須為匿名類型,或必須具有 EventDataAttribute 屬性標記。

備註

如果 為 eventNamenull,則事件名稱會自動衍生自類型 T 的事件數據, (Name) 或根據類型 T的名稱決定。 的 data 公用實例屬性會以遞歸方式寫入,以建立事件欄位。

適用於

Write<T>(String, EventSourceOptions, T)

來源:
TraceLoggingEventSource.cs
來源:
TraceLoggingEventSource.cs
來源:
TraceLoggingEventSource.cs

寫入具有指定名稱、選項和事件資料的事件。

public:
generic <typename T>
 void Write(System::String ^ eventName, System::Diagnostics::Tracing::EventSourceOptions % options, T % data);
public void Write<T> (string eventName, ref System.Diagnostics.Tracing.EventSourceOptions options, ref T data);
public void Write<T> (string? eventName, ref System.Diagnostics.Tracing.EventSourceOptions options, ref T data);
member this.Write : string * EventSourceOptions * 'T -> unit
Public Sub Write(Of T) (eventName As String, ByRef options As EventSourceOptions, ByRef data As T)

類型參數

T

定義事件的類型及其相關聯的資料。 此類型必須為匿名類型,或必須具有 EventSourceAttribute 屬性標記。

參數

eventName
String

事件的名稱。

options
EventSourceOptions

事件選項。

data
T

事件資料。 此類型必須為匿名類型,或必須具有 EventDataAttribute 屬性標記。

備註

如果 為 eventNamenull,則事件名稱會自動衍生自類型 T 的事件數據, (Name) 或根據類型 T的名稱決定。 的 data 公用實例屬性會以遞歸方式寫入,以建立事件欄位。

適用於

Write<T>(String, EventSourceOptions, Guid, Guid, T)

來源:
TraceLoggingEventSource.cs
來源:
TraceLoggingEventSource.cs
來源:
TraceLoggingEventSource.cs

寫入具有指定名稱、選項、相關活動和事件資料的事件。

public:
generic <typename T>
 void Write(System::String ^ eventName, System::Diagnostics::Tracing::EventSourceOptions % options, Guid % activityId, Guid % relatedActivityId, T % data);
public void Write<T> (string eventName, ref System.Diagnostics.Tracing.EventSourceOptions options, ref Guid activityId, ref Guid relatedActivityId, ref T data);
public void Write<T> (string? eventName, ref System.Diagnostics.Tracing.EventSourceOptions options, ref Guid activityId, ref Guid relatedActivityId, ref T data);
member this.Write : string * EventSourceOptions * Guid * Guid * 'T -> unit
Public Sub Write(Of T) (eventName As String, ByRef options As EventSourceOptions, ByRef activityId As Guid, ByRef relatedActivityId As Guid, ByRef data As T)

類型參數

T

定義事件的類型及其相關聯的資料。 此類型必須為匿名類型,或必須具有 EventSourceAttribute 屬性標記。

參數

eventName
String

事件的名稱。

options
EventSourceOptions

事件選項。

activityId
Guid

與事件關聯的活動識別碼。

relatedActivityId
Guid

關聯的活動識別碼;如果沒有關聯的活動,則為 Empty

data
T

事件資料。 此類型必須為匿名類型,或必須具有 EventDataAttribute 屬性標記。

備註

如果 為 eventNamenull,則事件名稱會自動衍生自類型 T 的事件數據, (Name) 或根據類型 T的名稱決定。 的 data 公用實例屬性會以遞歸方式寫入,以建立事件欄位。

適用於