Switch.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

一个 StringDictionary,包含跟踪开关的自定义特性(不区分大小写)。

示例

下面的代码示例演示如何显示自定义交换机的无法识别的属性。

// Get the custom attributes for the trace source switch.
foreach (DictionaryEntry de in ts.Switch.Attributes)
    Console.WriteLine(de.Key + "  " + de.Value);
' Get the custom attributes for the trace source switch.

For Each de In ts.Switch.Attributes
    Console.WriteLine(de.Key + "  " + de.Value)
Next de

注解

Attributes 属性标识应用程序配置文件中引用的自定义属性。 不枚举未推断的自定义属性。 继承自类的 Switch 类可以通过重写 GetSupportedAttributes 方法并返回自定义属性名称的字符串数组来添加自定义属性。

适用于