using System.Collections.Generic;
public static void Main(string[] args)
var strategies = new Dictionary<string, IStrategy>
["default"] = new DefaultColor(),
["green"] = new GreenColor(),
["cyan"] = new CyanColor()
args = args ?? new string[] { "default" };
var strategyKey = args[0];
if (!strategies.ContainsKey(strategyKey))
var text = "This will be printed in {0} color.";
strategies[strategyKey].Execute();
Console.WriteLine(text, args[0]);
public interface IStrategy
public sealed class DefaultColor : IStrategy
Console.WriteLine("Set to default console color.");
public sealed class CyanColor : IStrategy
Console.WriteLine("Cyan is pretty, if you're an idiot.");
public sealed class GreenColor : IStrategy
Console.WriteLine("Ah, green. A classic.");