Struct Size

Size structure

Stores an ordered pair of integers, typically the width and height of a rectangle.

public struct Size : IEquatable<Size>

Constructors

NameDescription
Size(Point)Initializes a new instance of the Size struct from the specified Point.
Size(int, int)Initializes a new instance of the Size struct from the specified dimensions.

Properties

NameDescription
Height { get; set; }Gets or sets the vertical component of this Size.
IsEmpty { get; }Gets a value indicating whether this Size has width and height of 0.
Width { get; set; }Gets or sets the horizontal component of this Size.

Methods

NameDescription
static Add(Size, Size)Adds the width and height of one Size structure to the width and height of another Size structure.
static Ceiling(SizeF)Converts the specified SizeF structure to a Size structure by rounding the values of the Size structure to the next higher integer values.
static Round(SizeF)Converts the specified SizeF structure to a Size structure by rounding the values of the SizeF structure to the nearest integer values.
static Subtract(Size, Size)Subtracts the width and height of one Size structure from the width and height of another Size structure.
static Truncate(SizeF)Converts the specified SizeF structure to a Size structure by truncating the values of the SizeF structure to the next lower integer values.
override Equals(object)Tests to see whether the specified object is a Size with the same dimensions as this Size.
Equals(Size)Tests whether other Size structure has the same size of this Size structure.
override GetHashCode()Returns a hash code for this Size structure.
override ToString()Converts the attributes of this Size to a human readable string.
operator +Adds the width and height of one Size structure to the width and height of another Size structure.
operator /Divides Size by an Int32 producing Size. (2 operators)
operator ==Tests whether two Size structures are equal.
explicit operatorConverts the specified Size to a Point.
implicit operatorConverts the specified Size to a SizeF.
operator !=Tests whether two Size structures are different.
operator *Multiplies a Size by an Int32 producing Size. (4 operators)
operator -Subtracts the width and height of one Size structure from the width and height of another Size structure.

Fields

NameDescription
static readonly EmptyGets a Size structure that has a Height and Width value of 0.

See Also