mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
feat(onboarding): dotnet snippet
This commit is contained in:
parent
c7427f4b91
commit
0f157b14e5
@ -7,14 +7,34 @@ dotnet add package Newtonsoft.Json
|
||||
|
||||
2\. Initialize Unleash
|
||||
```csharp
|
||||
using System;
|
||||
using Unleash;
|
||||
using Unleash.ClientFactory;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static async Task Main()
|
||||
{
|
||||
var settings = new UnleashSettings()
|
||||
{
|
||||
AppName = "unleash-onboarding-dotnet",
|
||||
AppName = "codesandbox-csharp",
|
||||
UnleashApi = new Uri("<YOUR_API_URL>"),
|
||||
SendMetricsInterval = TimeSpan.FromSeconds(1),
|
||||
CustomHttpHeaders = new Dictionary<string, string>()
|
||||
{
|
||||
{"Authorization", "<YOUR_API_TOKEN>"}
|
||||
}
|
||||
};
|
||||
|
||||
var unleash = new DefaultUnleash(settings);
|
||||
var flag = "example-flag";
|
||||
|
||||
while (true) {
|
||||
Console.WriteLine($"'{flag}' is enabled: {unleash.IsEnabled(flag)}");
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user