Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hbulens/d91d9325480351698db428ac4a8b2d33 to your computer and use it in GitHub Desktop.
Save hbulens/d91d9325480351698db428ac4a8b2d33 to your computer and use it in GitHub Desktop.
public class ConsoleColorScope : IDisposable
{
public ConsoleColorScope(ConsoleColor foregroundColor, ConsoleColor backgroundColor)
{
Console.BackgroundColor = backgroundColor;
Console.ForegroundColor = foregroundColor;
}
#region IDisposable Members
public void Dispose()
{
Console.ResetColor();
}
#endregion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment