Holds the width and height of an object (e.g. a rectangle).
View code on GitHub
Namespace: DeltaEngine.DatatypesAssembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The Size type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Size(Single) | Initializes a new instance of the Size class | |
Size(String) | Initializes a new instance of the Size class | |
Size(Single, Single) | Initializes a new instance of the Size class |
Methods
Name | Description | |
---|---|---|
Equals(Object) | (Overrides ValueType Equals(Object).) | |
Equals(Size) | ||
GetHashCode | (Overrides ValueType GetHashCode .) | |
IsNearlyEqual | ||
Lerp | ||
ToString | (Overrides ValueType ToString .) |
Operators
Name | Description | |
---|---|---|
Addition | ||
Division(Single, Size) | ||
Division(Size, Size) | ||
Division(Size, Single) | ||
Equality | ||
(Vector2D to Size) | ||
Inequality | ||
Multiply(Single, Size) | ||
Multiply(Size, Size) | ||
Multiply(Size, Single) | ||
Subtraction |
Fields
Name | Description | |
---|---|---|
Half | ||
One | ||
SizeInBytes | ||
Unused | ||
Zero |
Properties
Name | Description | |
---|---|---|
AspectRatio | ||
Height | ||
Length | ||
Width |
Remarks
Examples
[Test] public void StaticSizes() { Assert.AreEqual(new Size(), Size.Zero); Assert.AreEqual(new Size(0.0f, 0.0f), Size.Zero); Assert.AreEqual(new Size(0.5f, 0.5f), Size.Half); Assert.AreEqual(new Size(1.0f, 1.0f), Size.One); Assert.AreEqual(new Size(-1.0f, -1.0f), Size.Unused); Assert.AreEqual(8, Size.SizeInBytes); }
[Test] public void CreateWithEqualWidthAndHeight() { var size = new Size(-1.2f); Assert.AreEqual(-1.2f, size.Width); Assert.AreEqual(-1.2f, size.Height); }
[Test] public void CreateFromString() { var size = new Size("1.2, 2.4"); Assert.AreEqual(1.2f, size.Width); Assert.AreEqual(2.4f, size.Height); }
See Also