SDK quick linksLaunchDarkly’s SDKs are open source. In addition to this reference guide, we provide source, API reference documentation, and a sample application:
| Resource | Location |
|---|---|
| SDK API documentation | SDK API docs |
| Supported SDK Versions | .NET server SDK |
| GitHub repository | .NET (server-side) SDK |
| Sample application | .NET (server-side) OpenFeature .NET (server-side) |
| Published module | NuGet |
Get started
SDK version compatibilityThe LaunchDarkly .NET SDK, version 8.9 and higher, is compatible with .NET 8.The LaunchDarkly .NET SDK, version 7.0 and higher, is compatible with .NET 6.0+, .NET Framework 4.6.2+, .NET Standard 2.0+, and .NET Core 3.1.Prior to version 7.0, the LaunchDarkly .NET SDK also supported .NET 5.0, .NET Framework 4.5.2 and .NET Framework 4.6.1, and .NET Core 2.1.
Install the SDK
First, install the LaunchDarkly SDK as a dependency in your application using your application’s dependency manager. We recommend making the LaunchDarkly observability plugin available as well. This plugin collects and sends observability data to LaunchDarkly. This means you can review error monitoring and logs from within the LaunchDarkly UI. It requires the .NET (server-side) SDK version 8.10 or later. Here’s how:The .NET (server-side) SDK uses an SDK keyThe .NET (server-side) SDK uses an SDK key. Keys are specific to each project and environment. They are available on the SDK keys page under Settings. To learn more about key types, read Keys.
Initialize the client
After you install and import the SDK, create a single, shared instance ofLdClient. Specify your SDK key in the configuration to authorize your application to connect to a particular environment within LaunchDarkly.
To create a single instance:
ConfigurationBuilder.
Evaluate a context
You can useclient to check which variation a particular context will receive for a given feature flag. To learn more, read Flag variation evaluation and Flag variation evaluation details. For more information about how contexts are specified, read Context configuration.
In the v7 example, the context key is the string “example-context-key”. In the v6 example, the user key is the string “example-user-key”:
Kind method:
Transport Layer Security (TLS) and other networking issues
LaunchDarkly is deprecating support for TLS versions 1.0 and 1.1. .NET applications running on older operating systems are prone to use these older, less secure versions of TLS. It is possible to increase your application’s security using AppContext switches. To learn more, read Microsoft’s documentation. If you cannot update your application platform’s configurations to support TLS version 1.2, you can update your application’s SDK configuration to use new LaunchDarkly endpoints that support TLS versions 1.0 and later. Here is an example:Shut down the client
Shut down the client when your application terminates. To learn more, read Shutting down.Supported features
This SDK supports the following features:- SDK configuration, including
- Anonymous contexts and users
- Big segments
- Context configuration
- Data saving mode
- Flag variation evaluation
- Flag variation evaluation details
- Flushing events
- Getting all flags
- Hooks
- Identifying and changing contexts
- Logging configuration
- Migrations
- Monitoring SDK status
- Observability
- Offline mode
- OpenTelemetry
- Private attributes
- Reading flags from a file
- Relay Proxy configuration
- Secure mode
- Tracking custom events
- Shutting down
- Storing data
- Subscribing to flag changes
- Test data sources
- Web proxy configuration