Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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