Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created September 28, 2017 10:11
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 NMZivkovic/9df07b4fe89eaa50a48f595421bee557 to your computer and use it in GitHub Desktop.
Save NMZivkovic/9df07b4fe89eaa50a48f595421bee557 to your computer and use it in GitHub Desktop.
string data = "Item1";
var action1 = new Action(() => { Console.Write("This is one!"); });
var action2 = new Action(() => { Console.Write("This is two!"); });
var action3 = new Action(() => { Console.Write("This is three!"); });
switch (data)
{
case "Item1":
action1();
break;
case "Item2":
action2();
break;
default:
action3();
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment