Table of Contents

Struct Size

Namespace
Xui.Core.Math2D
Assembly
Core.dll

Represents a two-dimensional size with Width and Height components.

public struct Size
Inherited Members

Remarks

A Size specifies how much space an element occupies, without defining its position. It is commonly used in layout systems to describe constraints or measured results.

Constructors

Size()

Initializes a new instance of the Size struct with zero dimensions.

public Size()

Size(NFloat, NFloat)

Initializes a new instance of the Size struct with the given width and height.

public Size(NFloat width, NFloat height)

Parameters

width NFloat

The width of the size.

height NFloat

The height of the size.

Fields

Empty

A size with zero width and height.

public static readonly Size Empty

Field Value

Size

Height

The height of the element.

public NFloat Height

Field Value

NFloat

Infinity

A size with infinite width and height.

public static readonly Size Infinity

Field Value

Size

Width

The width of the element.

public NFloat Width

Field Value

NFloat

Methods

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

Equals(Size)

Returns true if this size is equal to the specified other.

public bool Equals(Size other)

Parameters

other Size

Returns

bool

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Max(Size, Size)

Returns the maximum of two sizes, using the larger width and height from each.

public static Size Max(Size lhs, Size rhs)

Parameters

lhs Size
rhs Size

Returns

Size

Min(Size, Size)

Returns the minimum of two sizes, using the smaller width and height from each.

public static Size Min(Size lhs, Size rhs)

Parameters

lhs Size
rhs Size

Returns

Size

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator +(Size, Frame)

Adds edge spacing from a Frame to a Size, increasing its dimensions.

public static Size operator +(Size size, Frame frame)

Parameters

size Size
frame Frame

Returns

Size

operator +(Size, Size)

Adds two sizes together component-wise.

public static Size operator +(Size lhs, Size rhs)

Parameters

lhs Size
rhs Size

Returns

Size

operator ==(Size, Size)

Returns true if the two sizes have the same dimensions.

public static bool operator ==(Size lhs, Size rhs)

Parameters

lhs Size
rhs Size

Returns

bool

explicit operator Size(Vector)

Explicitly converts a Vector to a Size.

public static explicit operator Size(Vector vector)

Parameters

vector Vector

Returns

Size

implicit operator Size(int)

Returns the size of a square.

public static implicit operator Size(int uniform)

Parameters

uniform int

Returns

Size

implicit operator Size((NFloat, NFloat))

Implicitly converts a tuple to a Size.

public static implicit operator Size((NFloat, NFloat) tuple)

Parameters

tuple (NFloat horizontal, NFloat vertical)

Returns

Size

operator !=(Size, Size)

Returns true if the two sizes have different dimensions.

public static bool operator !=(Size lhs, Size rhs)

Parameters

lhs Size
rhs Size

Returns

bool

operator -(Size, Frame)

Subtracts edge spacing from a Size, reducing its dimensions.

public static Size operator -(Size size, Frame frame)

Parameters

size Size
frame Frame

Returns

Size