Skip to main content

Size Structure

Defines a size.

Definition​

Namespace: Avalonia
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public readonly struct Size : IEquatable<Size>
View Source
InheritanceObject → ValueType → Size
ImplementsIEquatable(Size)

Constructors​

Size(Vector2)Initializes a new instance of the Size structure.
Size(Double, Double)Initializes a new instance of the Size structure.

Properties​

AspectRatioGets the aspect ratio of the size.
HeightGets the height.
WidthGets the width.

Methods​

Constrain(Size)Constrains the size.
Deconstruct(Double, Double)Deconstructs the size into its Width and Height values.
Deflate(Thickness)Deflates the size by a Thickness.
Equals(Object)Checks for equality between a size and an object.
(Overrides ValueType.Equals(Object))
Equals(Size)Returns a boolean indicating whether the size is equal to the other given size (bitwise).
GetHashCode()Returns a hash code for a Size.
(Overrides ValueType.GetHashCode())
GetType()Gets the Type of the current instance.
(Inherited from Object)
Inflate(Thickness)Inflates the size by a Thickness.
NearlyEquals(Size)Returns a boolean indicating whether the size is equal to the other given size (numerically).
Parse(String)Parses a Size string.
ToString()Returns the string representation of the size.
(Overrides ValueType.ToString())
WithHeight(Double)Returns a new Size with the same width and the specified height.
WithWidth(Double)Returns a new Size with the same height and the specified width.

Operators​

Addition(Size, Size) 
Division(Size, Size)Divides a size by another size to produce a scaling factor.
Division(Size, Vector)Scales a size.
Division(Size, Double)Scales a size.
Equality(Size, Size)Checks for equality between two Sizes.
Inequality(Size, Size)Checks for inequality between two Sizes.
Multiply(Size, Vector)Scales a size.
Multiply(Size, Double)Scales a size.
Subtraction(Size, Size) 

Fields​

InfinityA size representing infinity.

See Also​

Reference​

Avalonia Namespace