Bewerken

Delen via


Complex.UnaryNegation(Complex) Operator

Definition

Returns the additive inverse of a specified complex number.

public:
 static System::Numerics::Complex operator -(System::Numerics::Complex value);
public:
 static System::Numerics::Complex operator -(System::Numerics::Complex value) = System::Numerics::IUnaryNegationOperators<System::Numerics::Complex, System::Numerics::Complex>::op_UnaryNegation;
public static System.Numerics.Complex operator - (System.Numerics.Complex value);
static member ( ~- ) : System.Numerics.Complex -> System.Numerics.Complex
Public Shared Operator - (value As Complex) As Complex

Parameters

value
Complex

The value to negate.

Returns

The result of the Real and Imaginary components of the value parameter multiplied by -1.

Implements

Remarks

The UnaryNegation method defines the operation of the unary negation (additive inverse) operator for complex numbers. It enables code such as the following:

Complex c1 = new Complex(1.7, 3.9);
Complex c2 = -c1;
let c1 = Complex(1.7, 3.9)
let c2 = -c1
Dim c1 As New Complex(1.7, 3.9)
Dim c2 As Complex = -c1

The resulting complex number produces a value of Zero when it is added to the original complex number. Languages that don't support custom operators can call the Negate method instead.

The equivalent method for this operator is Complex.Negate(Complex)

Applies to

See also