Documentation Index
Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Version 5 of the .NET (client-side) SDK introduces support for .NET 7 and MAUI, and drops support for Xamarin. Version 5.5 introduces support for .NET
- To learn more about upgrading, read .NET (client-side) SDK 4.x to 5.0 migration guide. Version 4 of the .NET (client-side) SDK introduces optional automatic collection of environment attributes. To learn more about upgrading, read .NET (client-side) SDK 3.x to 4.0 migration guide.
Overview
This topic documents how to get started with the client-side .NET SDK, and links to reference information on all of the supported features.LaunchDarkly’s SDKs are open source. In addition to this reference guide, we provide source, API reference documentation, and sample applications:
| Resource | Location |
|---|---|
| SDK API documentation | SDK API docs |
| Supported SDK Versions | .NET client SDK |
| GitHub repository | .NET (client-side) SDK |
| Sample applications | .NET (client-side) |
| Published module | NuGet |
This SDK is intended for use in single-user mobile, desktop, and embedded applications. If you have a .NET application and want to set up LaunchDarkly on the server-side, read the server-side .NET SDK reference.To learn more about LaunchDarkly’s different SDK types, read Choosing an SDK type.
Get started
After you complete the Get started process, follow these instructions to start using the LaunchDarkly SDK in your application:Understand version compatibility
Starting with version 5, the .NET (client-side) SDK supports Microsoft’s .NET 7 and MAUI. Starting with version 5.5, the SDK supports Microsoft’s .NET 8. The LaunchDarkly .NET (client-side) SDK is compatible with Android version 5.0 and higher and with iOS version 11.0 and higher. It is also compatible with any other platform that supports .NET Standard version 2.0 or higher, although the .NET Standard version lacks some mobile-specific features such as detecting network connectivity. If you use Xamarin, you cannot use version 5 of the LaunchDarkly .NET (client-side) SDK. You must migrate to MAUI to continue using the LaunchDarkly SDK. To learn more about migrating, read Microsoft’s documentation on how to Upgrade from Xamarin to .NET.Install the SDK
To start using the client-side .NET SDK:Initialize the client
After you install the dependency, initialize the LaunchDarkly client by creating a single, shared instance ofLdClient. To create a client instance, you need your environment’s mobile key and the context for which you want to evaluate flags. This authorizes your application to connect to a particular environment within LaunchDarkly.
We recommend calling the client initialization method with a timeout of 0-5 seconds. This means your application blocks for a short period of time, until the SDK retrieves the latest feature flags from LaunchDarkly. We recommend that you do not set the timeout parameter for more than five seconds.
Here’s how:
Init method, we recommend that you do not set the timeout parameter for more than five seconds.
Older versions of the SDK allow you to initialize the SDK asynchronously without a timeout option. We do not recommend this because initializing without a timeout option will cause your app never to load if there is a connectivity problem.
To initialize asynchronously:
LdClient configuration options available in this SDK, read Configuration.
Evaluate a flag
After you create theclient, you can use it to check which variation a particular context will receive for a given feature flag.
Here’s how:
Using the Relay Proxy
You can configure the client-side .NET SDK to connect to the Relay Proxy as follows:Shut down the client
Shut down the client when your application terminates. To learn more, read Shutting down.Data collection
To learn more about data collection within this SDK and implications on submissions to the Apple App Store, read the Apple App Store data collection policy.Supported features
This SDK supports the following features:- Anonymous contexts and users
- Automatic environment attributes
- Configuration, including
- Context configuration
- Evaluating flags
- Flag evaluation reasons
- Flushing events
- Getting all flags
- Identifying and changing contexts
- Logging configuration
- Monitoring SDK status
- Offline mode
- Private attributes
- Relay Proxy configuration, using proxy mode
- Sending custom events
- Shutting down
- Subscribing to flag changes
- Test data sources
- Web proxy configuration