Vector.Add Method (Vector, Vector)

Adds two vectors and returns the result as a Vector structure.

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

public static Vector Add (
	Vector vector1,
	Vector vector2
)
public static Vector Add (
	Vector vector1, 
	Vector vector2
)
public static function Add (
	vector1 : Vector, 
	vector2 : Vector
) : Vector
You cannot use methods in XAML.

Parameters

vector1

The first vector to add.

vector2

The second vector to add.

Return Value

The sum of vector1 and vector2.

The following example shows how to use this method to add two Vector structures.

private Vector addTwoVectorsExample()
{
    // Create two Vector structures.
    Vector vector1 = new Vector(20, 30);
    Vector vector2 = new Vector(45, 70);
    Vector vectorResult = new Vector();

    // Add the vectors together. 
    // vectorResult is equal to (65, 100).
    vectorResult = Vector.Add(vector1, vector2);

    return vectorResult;

}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Show: