Show / Hide Table of Contents

# Struct Size

Stores an ordered pair of integers, which specify a Height and Width.

##### Inherited Members

System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)

###### Namespace: Terminal.Gui

###### Assembly: Terminal.Gui.dll

##### Syntax

    public struct Size

### Constructors

#### Size(Int32, Int32)

Size Constructor

##### Declaration

    public Size(int width, int height)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32 | width |
System.Int32 | height |

##### Remarks

Creates a Size from specified dimensions.

#### Size(Point)

Size Constructor

##### Declaration

    public Size(Point pt)

##### Parameters

Type | Name | Description
--- | --- | ---
Point | pt |

##### Remarks

Creates a Size from a Point value.

### Fields

#### Empty

Gets a Size structure that has a Height and Width value of 0.

##### Declaration

    public static readonly Size Empty

##### Field Value

Type | Description
--- | ---
Size |

### Properties

#### Height

Height Property

##### Declaration

    public int Height { get; set; }

##### Property Value

Type | Description
--- | ---
System.Int32 |

##### Remarks

The Height coordinate of the Size.

#### IsEmpty

IsEmpty Property

##### Declaration

    public bool IsEmpty { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

##### Remarks

Indicates if both Width and Height are zero.

#### Width

Width Property

##### Declaration

    public int Width { get; set; }

##### Property Value

Type | Description
--- | ---
System.Int32 |

##### Remarks

The Width coordinate of the Size.

### Methods

#### Add(Size, Size)

Adds the width and height of one Size structure to the width and height of another Size structure.

##### Declaration

    public static Size Add(Size sz1, Size sz2)

##### Parameters

Type | Name | Description
--- | --- | ---
Size | sz1 | The first Size structure to add.
Size | sz2 | The second Size structure to add.

##### Returns

Type | Description
--- | ---
Size | The add.

#### Equals(Object)

Equals Method

##### Declaration

    public override bool Equals(object obj)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | obj |

##### Returns

Type | Description
--- | ---
System.Boolean |

##### Overrides

System.ValueType.Equals(System.Object)

##### Remarks

Checks equivalence of this Size and another object.

#### GetHashCode()

GetHashCode Method

##### Declaration

    public override int GetHashCode()

##### Returns

Type | Description
--- | ---
System.Int32 |

##### Overrides

System.ValueType.GetHashCode()

##### Remarks

Calculates a hashing value.

#### Subtract(Size, Size)

Subtracts the width and height of one Size structure to the width and height of another Size structure.

##### Declaration

    public static Size Subtract(Size sz1, Size sz2)

##### Parameters

Type | Name | Description
--- | --- | ---
Size | sz1 | The first Size structure to subtract.
Size | sz2 | The second Size structure to subtract.

##### Returns

Type | Description
--- | ---
Size | The subtract.

#### ToString()

ToString Method

##### Declaration

    public override string ToString()

##### Returns

Type | Description
--- | ---
System.String |

##### Overrides

System.ValueType.ToString()

##### Remarks

Formats the Size as a string in coordinate notation.

### Operators

#### Addition(Size, Size)

Addition Operator

##### Declaration

    public static Size operator +(Size sz1, Size sz2)

##### Parameters

Type | Name | Description
--- | --- | ---
Size | sz1 |
Size | sz2 |

##### Returns

Type | Description
--- | ---
Size |

##### Remarks

Addition of two Size structures.

#### Equality(Size, Size)

Equality Operator

##### Declaration

    public static bool operator ==(Size sz1, Size sz2)

##### Parameters

Type | Name | Description
--- | --- | ---
Size | sz1 |
Size | sz2 |

##### Returns

Type | Description
--- | ---
System.Boolean |

##### Remarks

Compares two Size objects. The return value is based on the equivalence of the Width and Height properties of the two Sizes.

#### Explicit(Size to Point)

Size to Point Conversion

##### Declaration

    public static explicit operator Point(Size size)

##### Parameters

Type | Name | Description
--- | --- | ---
Size | size |

##### Returns

Type | Description
--- | ---
Point |

##### Remarks

Returns a Point based on the dimensions of a given Size. Requires explicit cast.

#### Inequality(Size, Size)

Inequality Operator

##### Declaration

    public static bool operator !=(Size sz1, Size sz2)

##### Parameters

Type | Name | Description
--- | --- | ---
Size | sz1 |
Size | sz2 |

##### Returns

Type | Description
--- | ---
System.Boolean |

##### Remarks

Compares two Size objects. The return value is based on the equivalence of the Width and Height properties of the two Sizes.

#### Subtraction(Size, Size)

Subtraction Operator

##### Declaration

    public static Size operator -(Size sz1, Size sz2)

##### Parameters

Type | Name | Description
--- | --- | ---
Size | sz1 |
Size | sz2 |

##### Returns

Type | Description
--- | ---
Size |

##### Remarks

Subtracts two Size structures.