Export (0) Print
Expand All

Complex.Equality Operator

Returns a value that indicates whether two complex numbers are equal.

Namespace:  System.Numerics
Assembly:  System.Numerics (in System.Numerics.dll)

public static bool operator ==(
	Complex left,
	Complex right
)

Parameters

left
Type: System.Numerics.Complex

The first complex number to compare.

right
Type: System.Numerics.Complex

The second complex number to compare.

Return Value

Type: System.Boolean
true if the left and right parameters have the same value; otherwise, false.

The Equality method defines the operation of the equality operator for Complex values. It enables code such as the following:

Complex c1 = new Complex(12.6, 4.3);
Complex c2 = new Complex(11.1, 8.9);
if (c1 == c2) 

Languages that do not support custom operators can call the Equals(Complex) method instead.

Two complex numbers are equal if their real parts are equal and their imaginary parts are equal. The Equality method is equivalent to the following expression:

return this.Real == value.Real && this.Imaginary == value.Imaginary;

Note that, because of differences in precision, two complex numbers that are apparently equivalent can be considered unequal. For more information and a possible workaround, see the Equals(Complex) method.

.NET Framework

Supported in: 4.5, 4

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1

Windows Phone 8.1, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft