EventSource.Write Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Writes an event.
Overloads
Write(String) |
Writes an event without fields, but with the specified name and default options. |
Write(String, EventSourceOptions) |
Writes an event without fields, but with the specified name and options. |
Write<T>(String, T) |
Writes an event with the specified name and data. |
Write<T>(String, EventSourceOptions, T) |
Writes an event with the specified name, event data and options. |
Write<T>(String, EventSourceOptions, T) |
Writes an event with the specified name, options and event data. |
Write<T>(String, EventSourceOptions, Guid, Guid, T) |
Writes an event with the specified name, options, related activity and event data. |
Write(String)
- Source:
- TraceLoggingEventSource.cs
- Source:
- TraceLoggingEventSource.cs
- Source:
- TraceLoggingEventSource.cs
Writes an event without fields, but with the specified name and default options.
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)
Parameters
- eventName
- String
The name of the event to write.
Exceptions
eventName
is null
.
Applies to
Write(String, EventSourceOptions)
- Source:
- TraceLoggingEventSource.cs
- Source:
- TraceLoggingEventSource.cs
- Source:
- TraceLoggingEventSource.cs
Writes an event without fields, but with the specified name and options.
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)
Parameters
- eventName
- String
The name of the event to write.
- options
- EventSourceOptions
The options such as level, keywords and operation code for the event.
Exceptions
eventName
is null
.
Applies to
Write<T>(String, T)
- Source:
- TraceLoggingEventSource.cs
- Source:
- TraceLoggingEventSource.cs
- Source:
- TraceLoggingEventSource.cs
Writes an event with the specified name and data.
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)
Type Parameters
- T
The type that defines the event and its associated data. This type must be an anonymous type or marked with the EventSourceAttribute attribute.
Parameters
- eventName
- String
The name of the event.
- data
- T
The event data. This type must be an anonymous type or marked with the EventDataAttribute attribute.
Remarks
If eventName
is null
, the event name is automatically derived from the type T's event data (Name) or determined based on the name of type T
. The public instance properties of data
will be written recursively to create the event fields.
Applies to
Write<T>(String, EventSourceOptions, T)
- Source:
- TraceLoggingEventSource.cs
- Source:
- TraceLoggingEventSource.cs
- Source:
- TraceLoggingEventSource.cs
Writes an event with the specified name, event data and options.
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)
Type Parameters
- T
The type that defines the event and its associated data. This type must be an anonymous type or marked with the EventSourceAttribute attribute.
Parameters
- eventName
- String
The name of the event.
- options
- EventSourceOptions
The event options.
- data
- T
The event data. This type must be an anonymous type or marked with the EventDataAttribute attribute.
Remarks
If eventName
is null
, the event name is automatically derived from the type T's event data (Name) or determined based on the name of type T
. The public instance properties of data
will be written recursively to create the event fields.
Applies to
Write<T>(String, EventSourceOptions, T)
- Source:
- TraceLoggingEventSource.cs
- Source:
- TraceLoggingEventSource.cs
- Source:
- TraceLoggingEventSource.cs
Writes an event with the specified name, options and event data.
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)
Type Parameters
- T
The type that defines the event and its associated data. This type must be an anonymous type or marked with the EventSourceAttribute attribute.
Parameters
- eventName
- String
The name of the event.
- options
- EventSourceOptions
The event options.
- data
- T
The event data. This type must be an anonymous type or marked with the EventDataAttribute attribute.
Remarks
If eventName
is null
, the event name is automatically derived from the type T's event data (Name) or determined based on the name of type T
. The public instance properties of data
will be written recursively to create the event fields.
Applies to
Write<T>(String, EventSourceOptions, Guid, Guid, T)
- Source:
- TraceLoggingEventSource.cs
- Source:
- TraceLoggingEventSource.cs
- Source:
- TraceLoggingEventSource.cs
Writes an event with the specified name, options, related activity and event data.
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)
Type Parameters
- T
The type that defines the event and its associated data. This type must be an anonymous type or marked with the EventSourceAttribute attribute.
Parameters
- eventName
- String
The name of the event.
- options
- EventSourceOptions
The event options.
- activityId
- Guid
The ID of the activity associated with the event.
- relatedActivityId
- Guid
The ID of an associated activity, or Empty if there is no associated activity.
- data
- T
The event data. This type must be an anonymous type or marked with the EventDataAttribute attribute.
Remarks
If eventName
is null
, the event name is automatically derived from the type T's event data (Name) or determined based on the name of type T
. The public instance properties of data
will be written recursively to create the event fields.