Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created September 28, 2017 10:27
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/089785972f2807ab7eba718b24acc2a5 to your computer and use it in GitHub Desktop.
Save NMZivkovic/089785972f2807ab7eba718b24acc2a5 to your computer and use it in GitHub Desktop.
foreach (var shape in shapes)
{
switch(shape.Value)
{
case Rectangle r:
Console.WriteLine(r.Height);
break;
case Circle c when c.Radius > 10:
Console.WriteLine(2 * c.Radius);
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment