DiagnosticSource.Write 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| Write(String, Object) |
提供记录复杂有效负载的一般方法。 |
| Write<T>(String, T) |
提供记录复杂有效负载的一般方法。 |
Write(String, Object)
- Source:
- DiagnosticSource.cs
- Source:
- DiagnosticSource.cs
- Source:
- DiagnosticSource.cs
- Source:
- DiagnosticSource.cs
- Source:
- DiagnosticSource.cs
- Source:
- DiagnosticSource.cs
- Source:
- DiagnosticSource.cs
提供记录复杂有效负载的一般方法。
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)
参数
- name
- String
正在写入的事件的名称。
- value
- Object
一个对象,表示作为事件的有效负载传递的值。 这通常是包含多个子值的匿名类型。
- 属性
注解
每个通知都有一个用于标识它的名称,以及一个对象(通常是匿名类型),该对象提供传递给通知的任意信息。
name 应为短。 除非必须避免歧义,否则不要使用完全限定的名称,因为 name 必须全局唯一。 通常, componentName.eventName( componentName 和 eventName 是小于 10 个字符的字符串)是一个很好的妥协。
通知名称中不应包含 . ,因为组件名称具有点,并且两者都有点会导致歧义。 建议改用 _ 。
假设侦听器将使用字符串前缀来筛选组。 因此,有组件名称的层次结构是一个很好的做法。
适用于
Write<T>(String, T)
- Source:
- DiagnosticSource.cs
- Source:
- DiagnosticSource.cs
- Source:
- DiagnosticSource.cs
- Source:
- DiagnosticSource.cs
- Source:
- DiagnosticSource.cs
- Source:
- DiagnosticSource.cs
提供记录复杂有效负载的一般方法。
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)
类型参数
- T
作为事件的有效负载传递的值的类型。
参数
- name
- String
正在写入的事件的名称。
- value
- T
一个对象,表示作为事件的有效负载传递的值。 这通常是包含多个子值的匿名类型。
- 属性