The following are the different ways to assign a value to a complex number:
By passing two Double values to its constructor. The first value represents the real, and the second value represents imaginary part of a complex number.
Complex c1 = new Complex(5, 8); /* It represents (5, 8) */
By assigning a Byte, SByte, Intl6, UIntl6, Int32, UInt32, Int64, UInt64, Single, or Double value to aComplex object. The assigned value represents the real part of the complex number, and its imaginary part becomes0. For example,
Complex c2 = 15.3; /* It represents (15.3, 0) */
By casting a Decimal or BigInteger value to a Complex object.
Complex c3 = (Complex) 14.7; /* It represents (14.7, 0) */
Assigning the value returned by an operator to a Complex variable.
Complex c4 = c1 + c2; /* It represents (20.3, 8) */