Rectangle ToString Method Delta Engine Documentation

Namespace: DeltaEngine.Datatypes
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public override string ToString()

Return Value

Type: String
Remarks

Tests: DeltaEngine.Tests.Datatypes.RectangleTests
Examples

2 unit tests call DeltaEngine.Datatypes.Rectangle.ToString
[Test]
public void RectangleToString()
{
    var v = new Vector2D(2f, 2f);
    var s = new Size(1f, 1f);
    var rect = new Rectangle(v, s);
    Assert.AreEqual("2, 2, 1, 1", rect.ToString());
}
[Test]
public void RectangleToStringAndFromString()
{
    var rect = new Rectangle(2.12f, 2.12f, 1.12f, 1.12f);
    string rectString = rect.ToString();
    Assert.AreEqual(rect, new Rectangle(rectString));
    Assert.AreEqual(Rectangle.One, new Rectangle("0, 0, 1, 1"));
    Assert.Throws<Rectangle.InvalidNumberOfComponents>(() => new Rectangle("abc"));
}
See Also