Struct Size
Describes the width and height of an object.
Implements
Inherited Members
Namespace: System.Windows
Assembly: OpenSilver.dll
Syntax
public struct Size : IFormattable
Constructors
| Improve this Doc View SourceSize(Double, Double)
Initializes a new instance of the Size structure and assigns it an initial width and height.
Declaration
public Size(double width, double height)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | width | The initial width of the instance of Size. |
| System.Double | height | The initial height of the instance of Size. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentException | width or height are less than 0. |
Properties
| Improve this Doc View SourceEmpty
Gets a value that represents a static empty Size.
Declaration
public static readonly Size Empty { get; }
Property Value
| Type | Description |
|---|---|
| Size | An empty instance of Size. |
Height
Gets or sets the height of this instance of Size.
Declaration
public double Height { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The Height of this instance of Size, in pixels. The default is 0. The value cannot be negative. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentException | Specified a value less than 0. |
IsEmpty
Declaration
public readonly bool IsEmpty { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Width
Gets or sets the width of this instance of Size.
Declaration
public double Width { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The Width of this instance of Size, in pixels. The default value is 0. The value cannot be negative. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentException | Specified a value less than 0. |
Methods
| Improve this Doc View SourceEquals(Object)
Compares an object to an instance of Size for equality.
Declaration
public override bool Equals(object o)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | o | The object to compare. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the sizes are equal; otherwise, false. |
Overrides
Equals(Size)
Compares a value to an instance of Size for equality.
Declaration
public bool Equals(Size value)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | value | The size to compare to this current instance of Size. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the instances of Size are equal; otherwise, false. |
Equals(Size, Size)
Compares two instances of Size for equality.
Declaration
public static bool Equals(Size size1, Size size2)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | size1 | The first instance of Size to compare. |
| Size | size2 | The second instance of Size to compare. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the instances of Size are equal; otherwise, false. |
GetHashCode()
Gets the hash code for this instance of Size.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 | The hash code for this instance of Size. |
Overrides
Parse(String)
Returns an instance of Size from a converted System.String.
Declaration
public static Size Parse(string source)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | source | A System.String value to parse to a Size value. |
Returns
| Type | Description |
|---|---|
| Size | An instance of Size. |
ToString()
Returns a string representation of this Size.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | A string representation of this Size. |
Overrides
ToString(IFormatProvider)
Returns a System.String that represents this instance of Size.
Declaration
public string ToString(IFormatProvider provider)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IFormatProvider | provider | An object that provides a way to control formatting. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String that represents this Size object. |
Operators
| Improve this Doc View SourceEquality(Size, Size)
Compares two instances of Size for equality.
Declaration
public static bool operator ==(Size size1, Size size2)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | size1 | The first instance of Size to compare. |
| Size | size2 | The second instance of Size to compare. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the two instances of Size are equal; otherwise false. |
Explicit(Size to Point)
Declaration
public static explicit operator Point(Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | size | The Size value to be converted. |
Returns
| Type | Description |
|---|---|
| Point |
Explicit(Size to Vector)
Declaration
public static explicit operator Vector(Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | size | The Size value to be converted. |
Returns
| Type | Description |
|---|---|
| Vector |
Inequality(Size, Size)
Compares two instances of Size for inequality.
Declaration
public static bool operator !=(Size size1, Size size2)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | size1 | The first instance of Size to compare. |
| Size | size2 | The second instance of Size to compare. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the instances of Size are not equal; otherwise false. |
Explicit Interface Implementations
| Improve this Doc View SourceIFormattable.ToString(String, IFormatProvider)
Creates a string representation of this object based on the format string and IFormatProvider passed in. If the provider is null, the CurrentCulture is used. See the documentation for IFormattable for more information.
Declaration
string IFormattable.ToString(string format, IFormatProvider provider)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | format | |
| System.IFormatProvider | provider |
Returns
| Type | Description |
|---|---|
| System.String | A string representation of this object. |