Struct Size
Universal structure that describes the size of an object in width and height in a two-dimensional space.
Implements
Inherited Members
Namespace: TheXDS.MCART.Types
Assembly: MCART.dll
Syntax
public struct Size : IFormattable, IEquatable<Size>, IEquatable<ISize>, ISize, IVector, IEquatable<IVector>, IEquatable<Vector2>
Constructors
| Edit this page View SourceSize(double, double)
Universal structure that describes the size of an object in width and height in a two-dimensional space.
Declaration
public Size(double width, double height)
Parameters
| Type | Name | Description |
|---|---|---|
| double | width | Width value. |
| double | height | Height value. |
Fields
| Edit this page View SourceNegativeInfinity
Gets a value that represents a negative infinite size. This field is read-only.
Declaration
public static readonly Size NegativeInfinity
Field Value
| Type | Description |
|---|---|
| Size |
Nothing
Gets a value that does not represent any size. This field is read-only.
Declaration
public static readonly Size Nothing
Field Value
| Type | Description |
|---|---|
| Size |
PositiveInfinity
Gets a value that represents an infinite size. This field is read-only.
Declaration
public static readonly Size PositiveInfinity
Field Value
| Type | Description |
|---|---|
| Size |
Zero
Gets a value that represents a null size. This field is read-only.
Declaration
public static readonly Size Zero
Field Value
| Type | Description |
|---|---|
| Size |
Properties
| Edit this page View SourceHeight
Gets the height component of the size.
Declaration
public double Height { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| double |
IsReal
Gets a value indicating whether the size is valid in a real physical context.
Declaration
public readonly bool IsReal { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsValid
Gets a value indicating whether all size magnitudes of this instance are valid.
Declaration
public readonly bool IsValid { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsZero
Determines if this instance represents a null size.
Declaration
public readonly bool? IsZero { get; }
Property Value
| Type | Description |
|---|---|
| bool? | true if the size is null, false if the size contains area, and null if any magnitude is undefined. |
SquareArea
Calculates the square area represented by this size.
Declaration
public readonly double SquareArea { get; }
Property Value
| Type | Description |
|---|---|
| double |
SquarePerimeter
Calculates the square perimeter represented by this size.
Declaration
public readonly double SquarePerimeter { get; }
Property Value
| Type | Description |
|---|---|
| double |
Width
Gets the width component of the size.
Declaration
public double Width { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| double |
Methods
| Edit this page View SourceEquals(object?)
Indicates whether this instance and a specified object are equal.
Declaration
public override readonly bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | Object to compare with the current instance. |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
| Edit this page View SourceEquals(ISize?)
Determines if this instance of ISize3D is equal to another.
Declaration
public readonly bool Equals(ISize? other)
Parameters
| Type | Name | Description |
|---|---|---|
| ISize | other | Instance of ISize3D to compare against. |
Returns
| Type | Description |
|---|---|
| bool | true if the sizes represented in both objects are equal, false otherwise. |
Equals(IVector?)
Determines if this instance of IVector3D is equal to another.
Declaration
public readonly bool Equals(IVector? other)
Parameters
| Type | Name | Description |
|---|---|---|
| IVector | other | Instance of IVector3D to compare against. |
Returns
| Type | Description |
|---|---|
| bool | true if the sizes represented in both objects are equal, false otherwise. |
Equals(Size)
Determines if this instance of Size is equal to another.
Declaration
public readonly bool Equals(Size other)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | other | Instance of Size to compare against. |
Returns
| Type | Description |
|---|---|
| bool | true if the sizes represented in both objects are equal, false otherwise. |
GetHashCode()
Returns the hash code generated for this instance.
Declaration
public override readonly int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A hash code that represents this instance. |
Overrides
| Edit this page View SourceParse(string)
Creates a Size from a string.
Declaration
public static Size Parse(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | Value to create a Size from. |
Returns
| Type | Description |
|---|---|
| Size | The created Size. |
Exceptions
| Type | Condition |
|---|---|
| FormatException | Thrown if the conversion failed. |
ToString()
Converts this object to its string representation.
Declaration
public override readonly string ToString()
Returns
| Type | Description |
|---|---|
| string | A string representation of this object. |
Overrides
| Edit this page View SourceToString(string?)
Converts this object to its string representation.
Declaration
public readonly string ToString(string? format)
Parameters
| Type | Name | Description |
|---|---|---|
| string | format | Format to use. |
Returns
| Type | Description |
|---|---|
| string | A string representation of this object. |
ToString(string?, IFormatProvider?)
Converts this object to its string representation.
Declaration
public readonly string ToString(string? format, IFormatProvider? formatProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| string | format | Format to use. |
| IFormatProvider | formatProvider | Optional parameter. Format provider for the culture to use for formatting the string representation of this object. If omitted, CurrentCulture will be used. |
Returns
| Type | Description |
|---|---|
| string | A string representation of this object. |
TryParse(string?, out Size)
Attempts to create a Size from a string.
Declaration
public static bool TryParse(string? value, out Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | Value to create a Size from. |
| Size | size | The created Size. |
Returns
| Type | Description |
|---|---|
| bool |
Operators
| Edit this page View Sourceoperator +(Size, double)
Performs an addition operation on the point.
Declaration
public static Size operator +(Size l, double r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| double | r | Addition operand. |
Returns
| Type | Description |
|---|---|
| Size | A new Size whose vectors are the sum of the
original vectors + |
operator +(Size, ISize)
Performs an addition operation on the points.
Declaration
public static Size operator +(Size l, ISize r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| ISize | r | Point 2. |
Returns
| Type | Description |
|---|---|
| Size | The sum of the vectors of the points. |
operator +(Size, IVector)
Performs an addition operation on the points.
Declaration
public static Size operator +(Size l, IVector r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| IVector | r | Point 2. |
Returns
| Type | Description |
|---|---|
| Size | The sum of the vectors of the points. |
operator +(Size, Size)
Performs an addition operation on the points.
Declaration
public static Size operator +(Size l, Size r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| Size | r | Point 2. |
Returns
| Type | Description |
|---|---|
| Size | The sum of the vectors of the points. |
operator --(Size)
Decrements by 1 the vectors of the point.
Declaration
public static Size operator --(Size p)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | p | Point to decrement. |
Returns
| Type | Description |
|---|---|
| Size | A point with its vectors decremented by 1. |
operator /(Size, double)
Performs a division operation on the point.
Declaration
public static Size operator /(Size l, double r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| double | r | Division operand. |
Returns
| Type | Description |
|---|---|
| Size | A new Size whose vectors are the division of
the original vectors / |
operator /(Size, ISize)
Performs a division operation on the points.
Declaration
public static Size operator /(Size l, ISize r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| ISize | r | Point 2. |
Returns
| Type | Description |
|---|---|
| Size | The division of the vectors of the points. |
operator /(Size, IVector)
Performs a division operation on the points.
Declaration
public static Size operator /(Size l, IVector r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| IVector | r | Point 2. |
Returns
| Type | Description |
|---|---|
| Size | The division of the vectors of the points. |
operator /(Size, Size)
Performs a division operation on the points.
Declaration
public static Size operator /(Size l, Size r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| Size | r | Point 2. |
Returns
| Type | Description |
|---|---|
| Size | The division of the vectors of the points. |
operator ==(Size, ISize)
Compares equality between two instances of Size.
Declaration
public static bool operator ==(Size size1, ISize size2)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | size1 | First element to compare. |
| ISize | size2 | Second element to compare. |
Returns
| Type | Description |
|---|---|
| bool | true if the sizes represented in both objects are equal, false otherwise. |
operator ==(Size, IVector)
Compares equality between two instances of Size.
Declaration
public static bool operator ==(Size size1, IVector size2)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | size1 | First element to compare. |
| IVector | size2 | Second element to compare. |
Returns
| Type | Description |
|---|---|
| bool | true if the sizes represented in both objects are equal, false otherwise. |
operator ==(Size, Size)
Compares equality between two instances of Size.
Declaration
public static bool operator ==(Size size1, Size size2)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | size1 | First element to compare. |
| Size | size2 | Second element to compare. |
Returns
| Type | Description |
|---|---|
| bool | true if the sizes represented in both objects are equal, false otherwise. |
implicit operator Size(Size)
Declaration
public static implicit operator Size(Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | size | Object to convert. |
Returns
| Type | Description |
|---|---|
| Size |
implicit operator Size(SizeF)
Declaration
public static implicit operator Size(SizeF size)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | size | Object to convert. |
Returns
| Type | Description |
|---|---|
| Size |
implicit operator Size(Vector2)
Declaration
public static implicit operator Size(Vector2 p)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | p | Vector2 value to be converted. |
Returns
| Type | Description |
|---|---|
| Size |
implicit operator Size(Size)
Declaration
public static implicit operator Size(Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | size | Object to convert. |
Returns
| Type | Description |
|---|---|
| Size |
implicit operator SizeF(Size)
Declaration
public static implicit operator SizeF(Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | size | Object to convert. |
Returns
| Type | Description |
|---|---|
| SizeF |
implicit operator Vector2(Size)
Declaration
public static implicit operator Vector2(Size p)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | p | Size value to be converted. |
Returns
| Type | Description |
|---|---|
| Vector2 |
operator ++(Size)
Increments by 1 the vectors of the point.
Declaration
public static Size operator ++(Size p)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | p | Point to increment. |
Returns
| Type | Description |
|---|---|
| Size | A point with its vectors incremented by 1. |
operator !=(Size, ISize)
Compares inequality between two instances of Size.
Declaration
public static bool operator !=(Size size1, ISize size2)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | size1 | First element to compare. |
| ISize | size2 | Second element to compare. |
Returns
| Type | Description |
|---|---|
| bool | true if the sizes represented in both objects are different, false otherwise. |
operator !=(Size, IVector)
Compares inequality between two instances of Size.
Declaration
public static bool operator !=(Size size1, IVector size2)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | size1 | First element to compare. |
| IVector | size2 | Second element to compare. |
Returns
| Type | Description |
|---|---|
| bool | true if the sizes represented in both objects are different, false otherwise. |
operator !=(Size, Size)
Compares inequality between two instances of Size.
Declaration
public static bool operator !=(Size size1, Size size2)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | size1 | First element to compare. |
| Size | size2 | Second element to compare. |
Returns
| Type | Description |
|---|---|
| bool | true if the sizes represented in both objects are different, false otherwise. |
operator %(Size, double)
Performs a remainder operation on the point.
Declaration
public static Size operator %(Size l, double r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| double | r | Remainder operand. |
Returns
| Type | Description |
|---|---|
| Size | A new Size whose vectors are the remainder of the
original vectors % |
operator %(Size, ISize)
Performs a remainder operation on the points.
Declaration
public static Size operator %(Size l, ISize r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| ISize | r | Point 2. |
Returns
| Type | Description |
|---|---|
| Size | The remainder of the vectors of the points. |
operator %(Size, IVector)
Performs a remainder operation on the points.
Declaration
public static Size operator %(Size l, IVector r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| IVector | r | Point 2. |
Returns
| Type | Description |
|---|---|
| Size | A new Size whose vectors are the remainder of the
original vectors % |
operator %(Size, Size)
Performs a remainder operation on the points.
Declaration
public static Size operator %(Size l, Size r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| Size | r | Point 2. |
Returns
| Type | Description |
|---|---|
| Size | The remainder of the vectors of the points. |
operator *(Size, double)
Performs a multiplication operation on the point.
Declaration
public static Size operator *(Size l, double r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| double | r | Multiplication operand. |
Returns
| Type | Description |
|---|---|
| Size | A new Size whose vectors are the multiplication
of the original vectors * |
operator *(Size, ISize)
Performs a multiplication operation on the points.
Declaration
public static Size operator *(Size l, ISize r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| ISize | r | Point 2. |
Returns
| Type | Description |
|---|---|
| Size | The multiplication of the vectors of the points. |
operator *(Size, IVector)
Performs a multiplication operation on the points.
Declaration
public static Size operator *(Size l, IVector r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| IVector | r | Point 2. |
Returns
| Type | Description |
|---|---|
| Size | The multiplication of the vectors of the points. |
operator *(Size, Size)
Performs a multiplication operation on the points.
Declaration
public static Size operator *(Size l, Size r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| Size | r | Point 2. |
Returns
| Type | Description |
|---|---|
| Size | The multiplication of the vectors of the points. |
operator -(Size, double)
Performs a subtraction operation on the point.
Declaration
public static Size operator -(Size l, double r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| double | r | Subtraction operand. |
Returns
| Type | Description |
|---|---|
| Size | A new Size whose vectors are the difference of the
original vectors - |
operator -(Size, ISize)
Performs a subtraction operation on the points.
Declaration
public static Size operator -(Size l, ISize r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| ISize | r | Point 2. |
Returns
| Type | Description |
|---|---|
| Size | The difference of the vectors of the points. |
operator -(Size, IVector)
Performs a subtraction operation on the points.
Declaration
public static Size operator -(Size l, IVector r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| IVector | r | Point 2. |
Returns
| Type | Description |
|---|---|
| Size | The difference of the vectors of the points. |
operator -(Size, Size)
Performs a subtraction operation on the points.
Declaration
public static Size operator -(Size l, Size r)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | l | Point 1. |
| Size | r | Point 2. |
Returns
| Type | Description |
|---|---|
| Size | The difference of the vectors of the points. |
operator -(Size)
Inverts the sign of the vectors of the point.
Declaration
public static Size operator -(Size p)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | p | Point to operate. |
Returns
| Type | Description |
|---|---|
| Size | A point with the sign of its vectors inverted. |
operator +(Size)
Converts to positive the vectors of the point.
Declaration
public static Size operator +(Size p)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | p | Point to operate. |
Returns
| Type | Description |
|---|---|
| Size | A point with its vectors positive. |