Редагувати

Поділитися через


DiagnosticSource.IsEnabled Method

Definition

Overloads

IsEnabled(String)

Verifies if the notification event is enabled.

IsEnabled(String, Object, Object)

Verifies it the notification event is enabled.

IsEnabled(String)

Source:
DiagnosticSource.cs
Source:
DiagnosticSource.cs
Source:
DiagnosticSource.cs

Verifies if the notification event is enabled.

public:
 abstract bool IsEnabled(System::String ^ name);
public abstract bool IsEnabled (string name);
abstract member IsEnabled : string -> bool
Public MustOverride Function IsEnabled (name As String) As Boolean

Parameters

name
String

The name of the event being written.

Returns

true if the notification event is enabled, false otherwise.

Remarks

If there is expensive setup for the notification, you can call IsEnabled before performing this setup. Consumers should not assume that they only get notifications for which IsEnabled is true. However, it is optional for producers to call this API. The name should be the same as that passed to Write(String, Object).

Applies to

IsEnabled(String, Object, Object)

Source:
DiagnosticSource.cs
Source:
DiagnosticSource.cs
Source:
DiagnosticSource.cs

Verifies it the notification event is enabled.

public virtual bool IsEnabled (string name, object? arg1, object? arg2 = default);
public virtual bool IsEnabled (string name, object arg1, object arg2 = default);
abstract member IsEnabled : string * obj * obj -> bool
override this.IsEnabled : string * obj * obj -> bool
Public Overridable Function IsEnabled (name As String, arg1 As Object, Optional arg2 As Object = Nothing) As Boolean

Parameters

name
String

The name of the event being written.

arg1
Object

An object that represents the additional context for IsEnabled. Consumers should expect to receive null which may indicate that producer called pure IsEnabled(string) to check if consumer wants to get notifications for such events at all. Based on that, producer may call IsEnabled(string, object, object) again with non-null context.

arg2
Object

Optional. An object that represents the additional context for IsEnabled. null by default. Consumers should expect to receive null which may indicate that producer called pure IsEnabled(string) or producer passed all necessary context in arg1.

Returns

true if the notification event is enabled, false otherwise.

Remarks

If there is expensive setup for the notification, you can call this method and provide context before performing the setup.

Applies to