diff --git a/src/Avalonia.Visuals/Point.cs b/src/Avalonia.Visuals/Point.cs index 4cce2c925b..7324f5fbd0 100644 --- a/src/Avalonia.Visuals/Point.cs +++ b/src/Avalonia.Visuals/Point.cs @@ -267,5 +267,24 @@ namespace Avalonia { return new Point(_x, y); } + + /// + /// Deconstructs the point into its X and Y coordinates. + /// + /// The X coordinate. + /// The Y coordinate. + public void Deconstruct(out double x, out double y) + { + x = this._x; + y = this._y; + } + + /// + /// Gets a value indicating whether the X and Y coordinates are zero. + /// + public bool IsDefault + { + get { return (_x == 0) && (_y == 0); } + } } } diff --git a/src/Avalonia.Visuals/Size.cs b/src/Avalonia.Visuals/Size.cs index f87b336b50..d87d2c5fc2 100644 --- a/src/Avalonia.Visuals/Size.cs +++ b/src/Avalonia.Visuals/Size.cs @@ -276,5 +276,24 @@ namespace Avalonia { return string.Format(CultureInfo.InvariantCulture, "{0}, {1}", _width, _height); } + + /// + /// Deconstructs the size into its Width and Height values. + /// + /// The width. + /// The height. + public void Deconstruct(out double width, out double height) + { + width = this._width; + height = this._height; + } + + /// + /// Gets a value indicating whether the Width and Height values are zero. + /// + public bool IsDefault + { + get { return (_width == 0) && (_height == 0); } + } } } diff --git a/src/Avalonia.Visuals/Thickness.cs b/src/Avalonia.Visuals/Thickness.cs index b03e91bf34..6d69c4d9a9 100644 --- a/src/Avalonia.Visuals/Thickness.cs +++ b/src/Avalonia.Visuals/Thickness.cs @@ -272,5 +272,28 @@ namespace Avalonia { return $"{_left},{_top},{_right},{_bottom}"; } + + /// + /// Deconstructor the thickness into its left, top, right and bottom thickness values. + /// + /// The thickness on the left. + /// The thickness on the top. + /// The thickness on the right. + /// The thickness on the bottom. + public void Deconstruct(out double left, out double top, out double right, out double bottom) + { + left = this._left; + top = this._top; + right = this._right; + bottom = this._bottom; + } + + /// + /// Gets a value indicating whether the left, top, right and bottom thickness values are zero. + /// + public bool IsDefault + { + get { return (_left == 0) && (_top == 0) && (_right == 0) && (_bottom == 0); } + } } } diff --git a/src/Avalonia.Visuals/Vector.cs b/src/Avalonia.Visuals/Vector.cs index 6059dc3971..2fcf804f14 100644 --- a/src/Avalonia.Visuals/Vector.cs +++ b/src/Avalonia.Visuals/Vector.cs @@ -333,5 +333,24 @@ namespace Avalonia /// public static Vector UnitY => new Vector(0, 1); + + /// + /// Deconstructs the vector into its X and Y components. + /// + /// The X component. + /// The Y component. + public void Deconstruct(out double x, out double y) + { + x = this._x; + y = this._y; + } + + /// + /// Gets a value indicating whether the X and Y components are zero. + /// + public bool IsDefault + { + get { return (_x == 0) && (_y == 0); } + } } }