Export (0) Print
Expand All

Vector.X Property

Gets or sets the X component of this vector.

Namespace:  System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

public double X { get; set; }
<object X="double" .../>

Property Value

Type: System.Double
The X component of this vector. The default value is 0.

The following example shows how to check two Vector structures for equality.

// Checks if two Vectors are equal using the overloaded equality operator. 
private Boolean vectorEqualityExample()

    // Declaring vecto1 and initializing x,y values
    Vector vector1 = new Vector(20, 30);

    // Declaring vector2 without initializing x,y values
    Vector vector2 = new Vector();

    // Boolean to hold the result of the comparison
    Boolean areEqual;

    // assigning values to vector2
    vector2.X = 45;
    vector2.Y = 70;

    // Comparing Vectors for equality 
    // areEqual is False
    areEqual = (vector1 == vector2);

    return areEqual;


.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft