C# Complex Explicit(Decimal to Complex)
Description
Complex Explicit(Decimal to Complex)
Defines an explicit
conversion of a Decimal value to a complex number.
Syntax
Complex.Explicit(Decimal to Complex)
has the following syntax.
public static explicit operator Complex (
decimal value
)
Parameters
Complex.Explicit(Decimal to Complex)
has the following parameters.
value
- The value to convert to a complex number.
Returns
Complex.Explicit(Decimal to Complex)
method returns A complex number that has a real component equal to value and an imaginary
component equal to zero.
Example
The following example illustrates the explicit conversion of Decimal values to Complex values.
using System;//w w w. j a v a2 s .c om
using System.Numerics;
public class Example
{
public static void Main()
{
decimal[] numbers = { Decimal.MinValue, -18.35m, 0m, 1893.019m,
Decimal.MaxValue };
foreach (decimal number in numbers)
{
System.Numerics.Complex c1 = (System.Numerics.Complex) number;
Console.WriteLine("{0,30} --> {1}", number, c1);
}
}
}
The code above generates the following result.