Switch.DisplayName 属性

定义

获取用于标识该开关的名称。Gets a name used to identify the switch.

public:
 property System::String ^ DisplayName { System::String ^ get(); };
public string DisplayName { get; }
member this.DisplayName : string
Public ReadOnly Property DisplayName As String

属性值

String

用于标识该开关的名称。The name used to identify the switch. 默认值为空字符串 ("")。The default value is an empty string ("").

示例

下面的代码示例显示了跟踪源正在使用的开关的显示名称。The following code example displays the display name for the switch in use by a trace source. 此代码示例摘自一个更大的示例,可在 TraceSource 类摘要中找到。This code example is part of a larger example that can be found in the TraceSource class summary.

Console.WriteLine(ts.Switch.DisplayName);
Console.WriteLine(ts.Switch.DisplayName)

注解

创建新的对象时 Switch ,将 DisplayName 查找初始开关设置。When you create a new Switch object, the DisplayName finds initial switch settings. 有关详细信息,请参阅 Switch Visual Studio 文档中的构造函数和 如何:创建、初始化和配置跟踪开关For more information, see the Switch constructor and How to: Create, Initialize and Configure Trace Switches in the Visual Studio documentation.

适用于

另请参阅