Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Vector Explicit Conversion (Vector to Size)


Creates a Size from the offsets of this vector.

Namespace:   System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)

public static explicit operator Size (
	Vector vector


Type: System.Windows.Vector

The vector to convert.

Return Value

Type: System.Windows.Size

A Size with a Width equal to the absolute value of this vector's X property and a Height equal to the absolute value of this vector's Y property.

The following example shows how to explicitly convert a Vector into a Size.

private Size overloadedExplicitOperatorExample1()
    Vector vector1 = new Vector(20, 30);

    // Explicitly converts a Vector structure into a Size structure.
    // returnSize has a width of 20 and a height of 30.
    Size returnSize = (Size)vector1;

    return returnSize;


.NET Framework
Available since 3.0
Return to top
© 2016 Microsoft