Compare two complex number values in CSharp

Description

The following code shows how to compare two complex number values.

Example


using System;/*from   w ww. jav a  2 s.  com*/
using System.Numerics;

public class Example
{
   public static void Main()
   {
     System.Numerics.Complex c1 = new System.Numerics.Complex(3.33333, .111111);
     System.Numerics.Complex c2 = new System.Numerics.Complex(10/3.0, 1.0/7);
     Console.WriteLine("{0} = {1}: {2}", c1, c2, c1.Equals(c2));       
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var