LSL.Disposables.EnvironmentVariables
A simple library to allow for disposable environment variables. It provides a scope for a set of environment variables and ensures that the state of the environment variables is restored after the scope has been disposed.
Quick Start
using LSL.Disposables.EnvironmentVariables;
...
using var disposableEnvironmentVars = new DisposableEnvironmentVariables();
Environment.SetVariable("test", "value");
// test is only available in this scope
// Any added variables will be removed once the
// scope has been exited (disposableEnvironmentVars has been disposed)