Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static string M1(Shape shape)
- {
- switch (shape)
- {
- case Shape s when s.Size.height > 100:
- return $"large shape with size {s.Size} at position {s.Position}";
- case Ellipse e:
- return $"Ellipse with size {e.Size} at position {e.Position}";
- case Rectangle r:
- return $"Rectangle with size {r.Size} at position {r.Position}";
- default:
- return "another shape";
- }
- }
Add Comment
Please, Sign In to add comment