Pragmatic.FeatureFlags
Context-aware feature flag evaluation for .NET 10 — targeting rules, percentage rollout, and deterministic bucketing.
The Problem
Section titled “The Problem”Apps need runtime control over feature visibility — gradual rollouts, A/B tests, beta programs, kill switches. Plain configuration gives you on/off, but the same value applies to every user, tenant, and environment, so teams hand-roll targeting:
// Without Pragmatic: hand-rolled targeting, duplicated and inconsistentvar isEnabled = betaTenants?.Contains(tenantId) == true || ComputeHash(userId) % 100 < rolloutPercent; // different result per hash/seed/roundingThat duplicates the hash-and-check pattern, gives no consistency guarantee (the same user flips between requests), has no change detection (caches serve stale toggles until restart), and conflates static configuration with context-dependent evaluation.
The Solution
Section titled “The Solution”Define flags with targeting rules; a deterministic evaluation engine handles the rest — stable per-user/tenant bucketing (the same input always resolves the same way), percentage rollout, and change watching.
store.Define(new FeatureFlagDefinition{ Name = "new-checkout", Enabled = false, Rules = [ new PercentageRule(20), new TenantRule("beta-co") ] // 20% rollout + beta tenant});
if (await flags.IsEnabledAsync("new-checkout", context)) { /* new path */ }Strongly-typed flags, pluggable stores, and change notifications are all supported.
Installation
Section titled “Installation”dotnet add package Pragmatic.FeatureFlagsStatus
Section titled “Status”The evaluation engine, targeting rules, deterministic bucketing, strongly-typed flags, and stores are functional within the 0.8 preview. See the roadmap.
| Concepts | Evaluation engine, rule types, deterministic bucketing, vs configuration | | Getting Started | Define a flag, add targeting, evaluate it | | Stores | Pluggable backends, change watching, strongly-typed flags | | Common Mistakes | The most frequent flag pitfalls | | Troubleshooting | Problem/solution guide |
Requirements
Section titled “Requirements”- .NET 10.0+
License
Section titled “License”Part of the Pragmatic.Design ecosystem — see Licensing. Pragmatic.FeatureFlags is MIT-licensed.