TraceListener.Attributes 属性
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取应用程序配置文件中定义的自定义跟踪侦听器特性。
public:
property System::Collections::Specialized::StringDictionary ^ Attributes { System::Collections::Specialized::StringDictionary ^ get(); };
C#
public System.Collections.Specialized.StringDictionary Attributes { get; }
member this.Attributes : System.Collections.Specialized.StringDictionary
Public ReadOnly Property Attributes As StringDictionary
包含自定义跟踪侦听器特性的 StringDictionary。
从 TraceListener 类继承的类可以通过重写 GetSupportedAttributes 方法并返回自定义属性名称的字符串数组来添加自定义属性。 属性 Attributes 标识在应用程序的配置文件中引用的自定义属性。 例如,在以下配置文件摘录中 DelimitedListTraceListener 引用了自定义属性“delimiter”。 在这种情况下, Attributes 属性返回一个 StringDictionary 包含字符串“delimiter”的 。
XML
<listeners>
<add name="delimitedListener"
type="System.Diagnostics.DelimitedListTraceListener"
delimiter=":"
initializeData="delimitedOutput.txt"
traceOutputOptions="ProcessId, DateTime" />
<remove name="Default" />
</listeners>
未引用的自定义属性不枚举。 有关更多信息,请参见 GetSupportedAttributes 方法。
产品 | 版本 |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |