Skip to content

Commit

Permalink
feat(onboarding): dotnet snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
Tymek committed Sep 25, 2024
1 parent c7427f4 commit 0f157b1
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions frontend/src/component/onboarding/snippets/dotnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,34 @@ dotnet add package Newtonsoft.Json

2\. Initialize Unleash
```csharp
using System;
using Unleash;
var settings = new UnleashSettings()
using Unleash.ClientFactory;
using System.Collections.Generic;
using System.Threading.Tasks;

public class Program
{
AppName = "unleash-onboarding-dotnet",
UnleashApi = new Uri("<YOUR_API_URL>"),
CustomHttpHeaders = new Dictionary<string, string>()
public static async Task Main()
{
{"Authorization","<YOUR_API_TOKEN>" }
var settings = new UnleashSettings()
{
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);
}
}
};
}
```

0 comments on commit 0f157b1

Please sign in to comment.