1
0
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:
Tymoteusz Czech 2024-09-25 15:47:49 +02:00
parent c7427f4b91
commit 0f157b14e5
No known key found for this signature in database
GPG Key ID: 133555230D88D75F

View File

@ -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);
}
}
}
```