DiagnosticSource.Write(String, Object) DiagnosticSource.Write(String, Object) DiagnosticSource.Write(String, Object) DiagnosticSource.Write(String, Object) Method

Definition

Provides a generic way of logging complex payloads.

public:
 abstract void Write(System::String ^ name, System::Object ^ value);
public abstract void Write (string name, object value);
abstract member Write : string * obj -> unit
Public MustOverride Sub Write (name As String, value As Object)

Parameters

name
String String String String

The name of the event being written.

value
Object Object Object Object

An object that represents the value being passed as a payload for the event. This is often an anonymous type which contains several sub-values.

Remarks

Each notification is given a name that identifies it, as well as an object (typically an anonymous type) that provides arbitrary information to pass to the notification.

name should be short. Don't use a fully qualified name unless you have to to avoid ambiguity, since name must be globally unique. Typically, componentName.eventName, where componentName and eventName are strings less than 10 characters, are a good compromise.

Notification names should not have . in them because component names have dots, and for them both to have dots leads to ambiguity. We suggest that you use _ instead.

Assume that listeners will use string prefixing to filter groups. Therefore, having a hierarchy of component names is a good practice.

Applies to