Xamarin.Forms Guides | Samples

Xamarin.Forms.Size Structure

Struct defining height and width as a pair of doubles.

See Also: Size


[System.Diagnostics.DebuggerDisplay("Width={Width}, Height={Height}")]
public struct Size


Application developers should be aware of the limits of floating-point representations, specifically the possibility of incorrect comparisons and equality checks for values with small differences. David Goldberg's paper What Every Computer Scientist Should Know About Floating-Point Arithmetic describes the issues excellently.


Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions:,,,,,,

The members of Xamarin.Forms.Size are listed below.

See Also: ValueType

Public Constructors

Creates a new Size object with width and height.

Public Fields

static readonly
ZeroSize. The Size whose values for height and width are 0.0.

Public Properties

HeightDouble. Magnitude along the vertical axis, in platform-specific units.
IsZeroBoolean. Whether the Size has Size.Height and Size.Width of 0.0.
WidthDouble. Magnitude along the horizontal axis, in platform-defined units.

Public Methods

Equals(Object) : Boolean
Whether thisSize is equivalent to obj.
Equals(Size) : Boolean
Whether thisSize is equivalent to other.
GetHashCode() : Int32
Returns a hash value for the Size.
ToString() : String
Returns a human-readable representation of the Size.

Public Operators

Addition(Size, Size)Returns a new Size whose Size.Height and Size.Width are the sum of the component's height and width.
Equality(Size, Size)Whether two Sizes have equal values.
Inequality(Size, Size)Whether two Sizes have unequal values.
Multiply(Size, Double)Scales both Size.Width and Size.Height.
Subtraction(Size, Size)Returns a new Size whose Size.Height and Size.Width are s1's height and width minus the values in s2.
Conversion to Xamarin.Forms.Point(Explicit)Returns a new Point based on a Size.