EventSource.IsEnabled 方法

定义

确定是否已启用当前事件源。

重载

IsEnabled()

确定是否已启用当前事件源。

IsEnabled(EventLevel, EventKeywords)

确定是否已启用具有指定级别和关键字的当前事件源。

IsEnabled(EventLevel, EventKeywords, EventChannel)

确定是否对带有指定级别、关键字和通道的事件启用了当前事件源。

IsEnabled()

确定是否已启用当前事件源。

public:
 bool IsEnabled();
public bool IsEnabled ();
member this.IsEnabled : unit -> bool
Public Function IsEnabled () As Boolean

返回

Boolean

如果启用了当前事件源,则为 true;否则为 false

适用于

IsEnabled(EventLevel, EventKeywords)

确定是否已启用具有指定级别和关键字的当前事件源。

public:
 bool IsEnabled(System::Diagnostics::Tracing::EventLevel level, System::Diagnostics::Tracing::EventKeywords keywords);
public bool IsEnabled (System.Diagnostics.Tracing.EventLevel level, System.Diagnostics.Tracing.EventKeywords keywords);
member this.IsEnabled : System.Diagnostics.Tracing.EventLevel * System.Diagnostics.Tracing.EventKeywords -> bool
Public Function IsEnabled (level As EventLevel, keywords As EventKeywords) As Boolean

参数

level
EventLevel

事件源级别。

keywords
EventKeywords

事件源的关键字。

返回

Boolean

如果启用了事件源,则为 true;否则为 false

注解

通过此方法的结果仅可大概了解特定的事件是否处于活动状态。 使用它可避免在禁用了记录的情况下因记录造成昂贵的计算费用。 事件源可能具有确定其活动的其他筛选。

适用于

IsEnabled(EventLevel, EventKeywords, EventChannel)

确定是否对带有指定级别、关键字和通道的事件启用了当前事件源。

public:
 bool IsEnabled(System::Diagnostics::Tracing::EventLevel level, System::Diagnostics::Tracing::EventKeywords keywords, System::Diagnostics::Tracing::EventChannel channel);
public bool IsEnabled (System.Diagnostics.Tracing.EventLevel level, System.Diagnostics.Tracing.EventKeywords keywords, System.Diagnostics.Tracing.EventChannel channel);
member this.IsEnabled : System.Diagnostics.Tracing.EventLevel * System.Diagnostics.Tracing.EventKeywords * System.Diagnostics.Tracing.EventChannel -> bool
Public Function IsEnabled (level As EventLevel, keywords As EventKeywords, channel As EventChannel) As Boolean

参数

level
EventLevel

要检查的事件级别。 当事件源的级别大于或等于 level 时,将其视为已启用。

keywords
EventKeywords

要检查的事件关键字。

channel
EventChannel

要检查的事件通道。

返回

Boolean

如果对指定的事件级别、关键字和通道启用了事件源,则为 true;否则为 false

通过此方法的结果仅可大概了解特定的事件是否处于活动状态。 使用它可避免在禁用了记录的情况下因记录造成昂贵的计算费用。 事件源可能具有确定其活动的其他筛选。

注解

如果你的设备不支持

适用于