Skip to content

Instantly share code, notes, and snippets.

@IEvangelist
Last active August 30, 2018 18:29
Show Gist options
  • Save IEvangelist/32e4b5ab40c44acc96581feca5cf7919 to your computer and use it in GitHub Desktop.
Save IEvangelist/32e4b5ab40c44acc96581feca5cf7919 to your computer and use it in GitHub Desktop.
Notice that there is no concern, no breaking changes whatsoever... Just additions.
public class Coordinates
{
    internal int X { get; }
    internal int Y { get; }
    internal int Z { get; }
    
    public Coordinates(int x, int y)
    {
        X = x;
        Y = y;        
    }
    
    public Coordinates(int x, int y, int z) : this(x, y)
    {
        Z = z;
    }
    
    public void Deconstruct(out int x, out int y)
    {
        x = X;
        y = Y;
    }
    
    public void Deconstruct(out int x, out int y, out int z)
    {    
        x = X;
        y = Y;
        z = Z;
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment