Dibaca dalam bahasa Inggeris Edit

Kongsi melalui


Vector(Double, Double) Constructor

Definition

Initializes a new instance of the Vector structure.

C#
public Vector(double x, double y);

Parameters

x
Double

The X-offset of the new Vector.

y
Double

The Y-offset of the new Vector.

Examples

The following example shows how to create two vectors and add them together.

C#
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;
}

Applies to

Produk Versi
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10