The TelemetryClient.IsEnabled property is a boolean value that determines whether the telemetry client is currently active or not. If the property is set to false, then no telemetry data will be sent to the associated Application Insights instance. The property can be set at runtime to enable/disable telemetry on-demand.
Example 1: Set telemetry client to inactive at startup
TelemetryClient client = new TelemetryClient(); client.IsEnabled = false;
In this example, we create a new TelemetryClient instance and immediately set the IsEnabled property to false, effectively preventing any telemetry data from being sent.
Example 2: Toggle telemetry client on/off using a button click event
In this example, we create a button that toggles the IsEnabled property of a new TelemetryClient instance each time it is clicked. This allows the user to control when telemetry data is sent based on their preferences.
The TelemetryClient class and IsEnabled property are part of the Microsoft.ApplicationInsights nuget package library.
C# (CSharp) TelemetryClient.IsEnabled - 18 examples found. These are the top rated real world C# (CSharp) examples of TelemetryClient.IsEnabled extracted from open source projects. You can rate examples to help us improve the quality of examples.