Struct Size
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
Fields
Empty
A size with zero width and height.
public static readonly Size Empty
Field Value
Height
The height of the element.
public NFloat Height
Field Value
Infinity
A size with infinite width and height.
public static readonly Size Infinity
Field Value
Width
The width of the element.
public NFloat Width
Field Value
Methods
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
obj
objectThe 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
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
Returns
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
Returns
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)
public static Size operator +(Size size, Frame frame)
Parameters
Returns
operator +(Size, Size)
Adds two sizes together component-wise.
public static Size operator +(Size lhs, Size rhs)
Parameters
Returns
operator ==(Size, Size)
Returns true
if the two sizes have the same dimensions.
public static bool operator ==(Size lhs, Size rhs)
Parameters
Returns
explicit operator Size(Vector)
public static explicit operator Size(Vector vector)
Parameters
vector
Vector
Returns
implicit operator Size(int)
Returns the size of a square.
public static implicit operator Size(int uniform)
Parameters
uniform
int
Returns
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
operator !=(Size, Size)
Returns true
if the two sizes have different dimensions.
public static bool operator !=(Size lhs, Size rhs)
Parameters
Returns
operator -(Size, Frame)
Subtracts edge spacing from a Size, reducing its dimensions.
public static Size operator -(Size size, Frame frame)