From 0f157b14e59c72d056a7429608c85ca7cdfb76a2 Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Wed, 25 Sep 2024 15:47:49 +0200 Subject: [PATCH] feat(onboarding): dotnet snippet --- .../component/onboarding/snippets/dotnet.md | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/frontend/src/component/onboarding/snippets/dotnet.md b/frontend/src/component/onboarding/snippets/dotnet.md index 9f965ba725..642d2b8688 100644 --- a/frontend/src/component/onboarding/snippets/dotnet.md +++ b/frontend/src/component/onboarding/snippets/dotnet.md @@ -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(""), - CustomHttpHeaders = new Dictionary() + public static async Task Main() { - {"Authorization","" } + var settings = new UnleashSettings() + { + AppName = "codesandbox-csharp", + UnleashApi = new Uri(""), + SendMetricsInterval = TimeSpan.FromSeconds(1), + CustomHttpHeaders = new Dictionary() + { + {"Authorization", ""} + } + }; + + var unleash = new DefaultUnleash(settings); + var flag = "example-flag"; + + while (true) { + Console.WriteLine($"'{flag}' is enabled: {unleash.IsEnabled(flag)}"); + await Task.Delay(1000); + } } -}; +} ```