Skip to content

Instantly share code, notes, and snippets.

@dimitris-papadimitriou-chr
Created July 10, 2020 04:05
Show Gist options
  • Select an option

  • Save dimitris-papadimitriou-chr/e93d461a948607f5ed3b40e2dee0677a to your computer and use it in GitHub Desktop.

Select an option

Save dimitris-papadimitriou-chr/e93d461a948607f5ed3b40e2dee0677a to your computer and use it in GitHub Desktop.
string GetShapeDescription(Shape shape)
=> shape.MatchWith<string>(
rectangleCase: r => $"Found {r.Height}x {r.Width} rectangle",
circleCase: c => $"found a circle with radius {c.Radius}"
);
var description = GetShapeDescription(shape);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment