Skip to content

C# Configuration

var client = FlagsClient.Create(options =>
{
// Required
options.Auth = new Auth
{
ProjectId = "project-id",
AgentId = "agent-id",
EnvironmentId = "env-id"
};
// Optional
options.Cache = new MemoryCache(); // default: SqliteCache
options.BaseUrl = "https://custom-api.flags.gg"; // default: https://api.flags.gg
options.MaxRetries = 3; // default: 3
options.HttpTimeout = TimeSpan.FromSeconds(10); // default: 10s
options.HttpClient = myHttpClient; // custom HttpClient
});
OptionDefaultDescription
AuthRequired. Authentication credentials
CacheSqliteCacheCache implementation
BaseUrlhttps://api.flags.ggAPI endpoint
MaxRetries3Max retry attempts
HttpTimeout10 secondsHTTP request timeout
HttpClientCustom HttpClient instance

Every operation has both async and sync versions:

AsyncSyncDescription
Is("name").EnabledAsync()Is("name").Enabled()Check if a flag is enabled
ListAsync()List()Get all flags

All operations are thread-safe and can be used concurrently:

var tasks = Enumerable.Range(0, 100)
.Select(_ => client.Is("feature").EnabledAsync());
var results = await Task.WhenAll(tasks);

Environment variable overrides support multiple formats:

true, 1, on, yes, enabled (truthy) false, 0, off, no, disabled (falsy)