DiagnosticSource.Write Metodo

Definizione

Overload

Nome Descrizione
Write(String, Object)

Fornisce un modo generico per registrare payload complessi.

Write<T>(String, T)

Fornisce un modo generico per registrare payload complessi.

Write(String, Object)

Origine:
DiagnosticSource.cs
Origine:
DiagnosticSource.cs
Origine:
DiagnosticSource.cs
Origine:
DiagnosticSource.cs
Origine:
DiagnosticSource.cs
Origine:
DiagnosticSource.cs
Origine:
DiagnosticSource.cs

Fornisce un modo generico per registrare payload complessi.

public:
 abstract void Write(System::String ^ name, System::Object ^ value);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The type of object being written to DiagnosticSource cannot be discovered statically.")]
public abstract void Write(string name, object? value);
public abstract void Write(string name, object? value);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The type of object being written to DiagnosticSource cannot be discovered statically.")]
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("DiagnosticSource may require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.")]
public abstract void Write(string name, object? value);
public abstract void Write(string name, object value);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The type of object being written to DiagnosticSource cannot be discovered statically.")>]
abstract member Write : string * obj -> unit
abstract member Write : string * obj -> unit
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The type of object being written to DiagnosticSource cannot be discovered statically.")>]
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("DiagnosticSource may require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.")>]
abstract member Write : string * obj -> unit
Public MustOverride Sub Write (name As String, value As Object)

Parametri

name
String

Nome dell'evento da scrivere.

value
Object

Oggetto che rappresenta il valore passato come payload per l'evento. Si tratta spesso di un tipo anonimo che contiene diversi sottovalori.

Attributi

Commenti

A ogni notifica viene assegnato un nome che lo identifica, nonché un oggetto (in genere un tipo anonimo) che fornisce informazioni arbitrarie da passare alla notifica.

name dovrebbe essere breve. Non usare un nome completo a meno che non sia necessario evitare ambiguità, perché name deve essere univoco a livello globale. In genere, componentName.eventName, dove componentName e eventName sono stringhe inferiori a 10 caratteri, rappresentano una buona compromissione.

I nomi delle notifiche non devono averlo . in essi perché i nomi dei componenti hanno punti e, per entrambi, avere punti porta a ambiguità. È consigliabile usare _ invece .

Si supponga che i listener usino il prefisso stringa per filtrare i gruppi. Pertanto, la presenza di una gerarchia di nomi di componenti è una procedura consigliata.

Si applica a

Write<T>(String, T)

Origine:
DiagnosticSource.cs
Origine:
DiagnosticSource.cs
Origine:
DiagnosticSource.cs
Origine:
DiagnosticSource.cs
Origine:
DiagnosticSource.cs
Origine:
DiagnosticSource.cs

Fornisce un modo generico per registrare payload complessi.

public:
generic <typename T>
 void Write(System::String ^ name, T value);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Only the properties of the T type will be preserved. Properties of referenced types and properties of derived types may be trimmed.")]
public void Write<T>(string name, T value);
public void Write<T>(string name, T value);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Only the properties of the T type will be preserved. Properties of referenced types and properties of derived types may be trimmed.")>]
member this.Write : string * 'T -> unit
member this.Write : string * 'T -> unit
Public Sub Write(Of T) (name As String, value As T)

Parametri di tipo

T

Tipo del valore passato come payload per l'evento.

Parametri

name
String

Nome dell'evento da scrivere.

value
T

Oggetto che rappresenta il valore passato come payload per l'evento. Si tratta spesso di un tipo anonimo che contiene diversi sottovalori.

Attributi

Si applica a