Class Size
A size (width and height).
Inheritance
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class Size : IComparable
Constructors
Size()
Initializes a new instance of the Size class.
Declaration
public Size()
Size(Int32, Int32)
Initializes a new instance of the Size class.
Declaration
public Size(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
System. |
width | The width. |
System. |
height | The height. |
Properties
Empty
Gets the empty size (0x0).
Declaration
public static Size Empty { get; }
Property Value
Type | Description |
---|---|
Size |
Height
Gets or sets the height.
Declaration
public int Height { get; set; }
Property Value
Type | Description |
---|---|
System. |
Width
Gets or sets the width.
Declaration
public int Width { get; set; }
Property Value
Type | Description |
---|---|
System. |
Methods
CompareTo(Object)
Compares this instance to a specified size and returns an indication of their relative values.
Declaration
public int CompareTo(object size)
Parameters
Type | Name | Description |
---|---|---|
System. |
size | A size to compare. |
Returns
Type | Description |
---|---|
System. |
A signed number indicating the relative values of this instance and size. |
Equals(Size)
Determines whether the specified size is equivalent to the current size. Does not require the object pointers to match.
Declaration
public bool Equals(Size size)
Parameters
Type | Name | Description |
---|---|---|
Size | size | The size to compare with the current object. |
Returns
Type | Description |
---|---|
System. |
true if the specified size is equivalent to the current size; otherwise, false. |
Equals(Object)
Determines whether the specified object is equivalent to the current size. Does not require the object pointers to match.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System. |
obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
System. |
true if the specified object is equivalent to the current object; otherwise, false. |
FromJson(String)
Deserializes an instance from JSON.
Declaration
public static Size FromJson(string sizeJson)
Parameters
Type | Name | Description |
---|---|---|
System. |
sizeJson | The JSON to deserialize. |
Returns
Type | Description |
---|---|
Size | The deserialized size. |
FromStruct(System.Drawing.Size)
Converts a System.Drawing.Size to a Size.
Declaration
public static Size FromStruct(System.Drawing.Size size)
Parameters
Type | Name | Description |
---|---|---|
System. |
size |
Returns
Type | Description |
---|---|
Size |
GetHashCode()
Gets a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System. |
A hash code. |
IsEquivalent(Size)
Determines whether the specified size is equivalent.
Declaration
public bool IsEquivalent(Size size)
Parameters
Type | Name | Description |
---|---|---|
Size | size | The size. |
Returns
Type | Description |
---|---|
System. |
IsEquivalent(Size, Size)
Determines whether the two sizes are equivalent.
Declaration
public static bool IsEquivalent(Size size1, Size size2)
Parameters
Returns
Type | Description |
---|---|
System. |
ToJson()
Serializes this instance to JSON.
Declaration
public string ToJson()
Returns
Type | Description |
---|---|
System. |
The serialized JSON. |
ToJson(Size)
Serializes an instance to JSON.
Declaration
public static string ToJson(Size size)
Parameters
Type | Name | Description |
---|---|---|
Size | size | The size. |
Returns
Type | Description |
---|---|
System. |
The serialized JSON. |
ToString()
Returns a string that represents this instance using format "{width}x{height}".
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System. |
ToStruct()
Converts this Size to a System.Drawing.Size.
Declaration
public System.Drawing.Size ToStruct()
Returns
Type | Description |
---|---|
System. |
ToStruct(Size)
Converts a Size to a System.Drawing.Size.
Declaration
public static System.Drawing.Size ToStruct(Size size)
Parameters
Type | Name | Description |
---|---|---|
Size | size |
Returns
Type | Description |
---|---|
System. |
Operators
Equality(Size, Size)
Determines whether the specified size is equivalent to the current size. Does not require the object pointers to match.
Declaration
public static bool operator ==(Size size1, Size size2)
Parameters
Returns
Type | Description |
---|---|
System. |
true if the specified size is equivalent to the current size; otherwise, false. |
Inequality(Size, Size)
Determines whether the specified size is NOT equivalent to the current size.
Declaration
public static bool operator !=(Size size1, Size size2)
Parameters
Returns
Type | Description |
---|---|
System. |
true if the specified size is NOT equivalent to the current size; otherwise, false. |