Language

Size Struct

Definition

Struct defining height and width as a pair of doubles.

[System.Diagnostics.DebuggerDisplay("Width={Width}, Height={Height}")]
[Xamarin.Forms.TypeConverter(typeof(Xamarin.Forms.SizeTypeConverter))]
public struct Size
type Size = struct
Inheritance
System.ValueType
Size
Attributes
System.Diagnostics.DebuggerDisplayAttribute TypeConverterAttribute

Remarks

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.

Constructors

Name Description
Size(Double, Double)

Creates a new Size object with width and height.

Fields

Name Description
Zero

The Size whose values for height and width are 0.0.

Properties

Name Description
Height

Magnitude along the vertical axis, in platform-specific units.

IsZero

Whether the Size has Height and Width of 0.0.

Width

Magnitude along the horizontal axis, in platform-defined units.

Methods

Name Description
Deconstruct(Double, Double)
Equals(Object)

Whether thisSize is equivalent to obj.

Equals(Size)

Whether thisSize is equivalent to other.

GetHashCode()

Returns a hash value for the Size.

ToString()

Returns a human-readable representation of the Size.

Operators

Name Description
Addition(Size, Size)

Returns a new Size whose Height and Width are the sum of the component's height and width.

Equality(Size, Size)

Whether two Sizes have equal values.

Explicit(Size to Point)

Returns a new Point based on a Size.

Inequality(Size, Size)

Whether two Sizes have unequal values.

Multiply(Size, Double)

Scales both Width and Height.

Subtraction(Size, Size)

Returns a new Size whose Height and Width are s1's height and width minus the values in s2.

Applies to