Created
June 19, 2018 11:27
-
-
Save christiannagel/61a4f32a0169c443a2318acfbd198829 to your computer and use it in GitHub Desktop.
Shape class used by pattern matching samples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class Shape | |
{ | |
public (int x, int y) Position { get; } | |
public (int height, int width) Size { get; } | |
public Shape((int x, int y) position, (int height, int width) size) | |
=> (Position, Size) = (position, size); | |
public void Deconstruct(out (int x, int y) position, out (int x, int y) size) | |
=> (position, size) = (Position, Size); | |
public string Name => GetType().Name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment