Skip to content

Instantly share code, notes, and snippets.

@christiannagel
Created June 19, 2018 11:27
Show Gist options
  • Save christiannagel/61a4f32a0169c443a2318acfbd198829 to your computer and use it in GitHub Desktop.
Save christiannagel/61a4f32a0169c443a2318acfbd198829 to your computer and use it in GitHub Desktop.
Shape class used by pattern matching samples
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