Complex.Equality Operator
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Returns a value that indicates whether two complex numbers are equal.
Namespace: System.Numerics
Assembly: System.Numerics (in System.Numerics.dll)
Syntax
'Declaration
Public Shared Operator = ( _
left As Complex, _
right As Complex _
) As Boolean
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.
Remarks
The Equality method defines the operation of the equality operator for Complex values. It enables code such as the following:
Dim c1 As New Complex(12.6, 4.3)
Dim c2 As New Complex(11.1, 8.9)
If c1 = c2 Then
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 Me.real = value.Real AndAlso Me.imaginary = value.Imaginary
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.
Version Information
Silverlight
Supported in: 5, 4
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.