Skip to content

C# SDK

C#v0.1.3
Terminal window
dotnet add package Flags.GG
using Flags.GG.Client;
using Flags.GG.Models;
var client = FlagsClient.Create(options =>
{
options.Auth = new Auth
{
ProjectId = "your-project-id",
AgentId = "your-agent-id",
EnvironmentId = "your-environment-id"
};
});
// Async
if (await client.Is("new-feature").EnabledAsync())
{
Console.WriteLine("Feature is enabled!");
}
// Sync
if (client.Is("new-feature").Enabled())
{
Console.WriteLine("Feature is enabled!");
}
// List all flags
var flags = await client.ListAsync();
foreach (var flag in flags)
{
Console.WriteLine($"{flag.Details.Name}: {flag.Enabled}");
}

The client implements IDisposable:

using var client = FlagsClient.Create(options => { /* ... */ });
// Automatically disposed at end of scope