Skip to content

Instantly share code, notes, and snippets.

@christiannagel
Created June 19, 2018 11:40
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 christiannagel/ed77b29899aee2b392a5ad25151755f1 to your computer and use it in GitHub Desktop.
Save christiannagel/ed77b29899aee2b392a5ad25151755f1 to your computer and use it in GitHub Desktop.
Sample Main method for pattern matching
static void Main()
{
var r1 = new Rectangle(position: (200, 200), size: (200, 200));
var e1 = new Ellipse(position: (80, 1400), size: (80, 140));
var shapes = new Shape[]
{
r1,
e1,
new Circle((40, 60), 90),
new CombinedShape(r1, e1)
};
foreach (var shape in shapes)
{
Console.WriteLine(M1(shape));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment