C# Complex ToString(IFormatProvider)

Description

Complex ToString(IFormatProvider) Converts the value of the current complex number to its equivalent string representation in Cartesian form by using the specified culture-specific formatting information.

Syntax

Complex.ToString(IFormatProvider) has the following syntax.


public string ToString(
  IFormatProvider provider
)

Parameters

Complex.ToString(IFormatProvider) has the following parameters.

  • provider - An object that supplies culture-specific formatting information.

Returns

Complex.ToString(IFormatProvider) method returns The string representation of the current instance in Cartesian form, as specified by provider.

Example


using System;/*from ww  w.j  av  a  2  s. c o  m*/
using System.Globalization;
using System.Numerics;

public class Example
{
   public static void Main()
   {
      Complex[] c = { new Complex(17.3, 14.1),  
                      new Complex(-1.4, -1.002) };
      CultureInfo[] cultures = { new CultureInfo("en-US"), 
                                 new CultureInfo("fr-FR") };
      foreach (Complex c1 in c)
      {
         foreach (CultureInfo culture in cultures)
            Console.Write("{0} ({1})    ", c1.ToString(culture), culture.Name);

         Console.WriteLine();
      }                          
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Numerics »




BigInteger
Complex