TraceListener.Attributes 属性

定义

获取在应用程序配置文件中定义的自定义跟踪侦听器属性。

public:
 property System::Collections::Specialized::StringDictionary ^ Attributes { System::Collections::Specialized::StringDictionary ^ get(); };
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 引用自定义属性“分隔符”。 在这种情况下,该 Attributes 属性返回一个 StringDictionary 包含字符串“delimiter” 的字符串。

<listeners>
  <add name="delimitedListener"
    type="System.Diagnostics.DelimitedListTraceListener"
    delimiter=":"
    initializeData="delimitedOutput.txt"
    traceOutputOptions="ProcessId, DateTime" />
  <remove name="Default" />
</listeners>

未枚举未引用的自定义属性。 有关更多信息,请参见 GetSupportedAttributes 方法。

适用于