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.LengthSquared Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets the square of the length of this vector.

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

public double LengthSquared { get; }

Property Value

Type: System.Double

The square of the Length of this vector.

The length of a vector is sometimes referred to as its magnitude.

The following example shows how to use this property to get the square of the length of a vector.

private Double lengthSquaredExample()

    Vector vector1 = new Vector(20, 30); 

    // Gets the square of the length of a Vector. 
    // lengthSq is equal to 1300.
    Double lengthSqResult = vector1.LengthSquared;

    return lengthSqResult;


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