CSharp - Essential Types AppContext class

Introduction

System.AppContext class provides a global string-keyed dictionary of Boolean values.

It offers library writers a standard way for allowing consumers to switch new features on or off.

The consumer of a library enables a feature as follows:

AppContext.SetSwitch ("MyLibrary.SomeBreakingChange", true);

Code from that library can check for that switch as follows:

bool isDefined, switchValue;
isDefined = AppContext.TryGetSwitch ("MyLibrary.SomeBreakingChange",out switchValue);

TryGetSwitch returns false if the switch is undefined.