Show / Hide Table of Contents

Struct Size

Universal structure that describes the size of an object in width and height in a two-dimensional space.

Implements
IFormattable
IEquatable<Size>
IEquatable<ISize>
ISize
IVector
IEquatable<IVector>
IEquatable<Vector2>
Inherited Members
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
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 Source

Size(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 Source

NegativeInfinity

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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 Source

Height

Gets the height component of the size.

Declaration
public double Height { readonly get; set; }
Property Value
Type Description
double
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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.

| Edit this page View Source

SquareArea

Calculates the square area represented by this size.

Declaration
public readonly double SquareArea { get; }
Property Value
Type Description
double
| Edit this page View Source

SquarePerimeter

Calculates the square perimeter represented by this size.

Declaration
public readonly double SquarePerimeter { get; }
Property Value
Type Description
double
| Edit this page View Source

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 Source

Equals(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

true if this instance and obj are equal; otherwise, false.

Overrides
ValueType.Equals(object)
| Edit this page View Source

Equals(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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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
ValueType.GetHashCode()
| Edit this page View Source

Parse(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.

| Edit this page View Source

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
ValueType.ToString()
| Edit this page View Source

ToString(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.

| Edit this page View Source

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.

| Edit this page View Source

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

true if the conversion was successful, false otherwise.

Operators

| Edit this page View Source

operator +(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 + r.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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 / r.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

implicit operator Size(Size)

Implicitly converts a Size object to a Size.

Declaration
public static implicit operator Size(Size size)
Parameters
Type Name Description
Size size

Object to convert.

Returns
Type Description
Size
| Edit this page View Source

implicit operator Size(SizeF)

Implicitly converts a Size object to a SizeF.

Declaration
public static implicit operator Size(SizeF size)
Parameters
Type Name Description
SizeF size

Object to convert.

Returns
Type Description
Size
| Edit this page View Source

implicit operator Size(Vector2)

Implicitly converts a Vector2 to a Size.

Declaration
public static implicit operator Size(Vector2 p)
Parameters
Type Name Description
Vector2 p

Vector2 value to be converted.

Returns
Type Description
Size
| Edit this page View Source

implicit operator Size(Size)

Implicitly converts a Size object to a Size.

Declaration
public static implicit operator Size(Size size)
Parameters
Type Name Description
Size size

Object to convert.

Returns
Type Description
Size
| Edit this page View Source

implicit operator SizeF(Size)

Implicitly converts a SizeF object to a Size.

Declaration
public static implicit operator SizeF(Size size)
Parameters
Type Name Description
Size size

Object to convert.

Returns
Type Description
SizeF
| Edit this page View Source

implicit operator Vector2(Size)

Implicitly converts a Size to a Vector2.

Declaration
public static implicit operator Vector2(Size p)
Parameters
Type Name Description
Size p

Size value to be converted.

Returns
Type Description
Vector2
| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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 % r.

| Edit this page View Source

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.

| Edit this page View Source

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 % r.

| Edit this page View Source

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.

| Edit this page View Source

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 * r.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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 - r.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

Implements

IFormattable
IEquatable<T>
IEquatable<T>
ISize
IVector
IEquatable<T>
IEquatable<T>

Extension Methods

Objects.ShallowCopyTo(object, object, Type)
ObjectExtensions.FieldsOf<T>(object)
ObjectExtensions.GetAttribute<T>(object)
ObjectExtensions.GetAttributes<T>(object)
ObjectExtensions.HasAttrValue<TAttribute, TValue>(object, out TValue)
ObjectExtensions.HasAttribute<T>(object)
ObjectExtensions.HasAttribute<T>(object, out T?)
ObjectExtensions.HasAttributes<T>(object, out IEnumerable<T>?)
ObjectExtensions.Is(object?, object?)
ObjectExtensions.IsEither(object, IEnumerable)
ObjectExtensions.IsEither(object, params object[])
ObjectExtensions.IsNeither(object, IEnumerable)
ObjectExtensions.IsNeither(object, params object[])
ObjectExtensions.IsNot(object?, object?)
ObjectExtensions.PropertiesOf<T>(object)
ObjectExtensions.WhichAre(object, IEnumerable<object>)
ObjectExtensions.WhichAre(object, params object[])
Objects.Itself<T>(T)
Objects.ShallowClone<T>(T)
Objects.ShallowCopyTo<T>(T, T)
AvaloniaSizeExtensions.ToSize(Size)
CollectionExtensions.PushInto<TItem, TCollection>(TItem, ICollection<TCollection>)
DictionaryExtensions.PushInto<TKey, TValue>(TValue, TKey, IDictionary<TKey, TValue>)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX