Parse() public static method

Converts the specified string to its Complex equivalent.
String representation of the complex number is not correctly formatted.
public static Parse ( string s ) : Complex
s string A string representation of a complex number.
return Complex
Beispiel #1
0
 /// <summary>
 /// Try to convert the specified string to its <see cref="Complex"/> equivalent.
 /// </summary>
 ///
 /// <param name="s">A string representation of a complex number.</param>
 ///
 /// <param name="result"><see cref="Complex"/> instance to output the result to.</param>
 ///
 /// <returns>Returns boolean value that indicates if the parse was successful or not.</returns>
 ///
 public static bool TryParse(string s, out Complex result)
 {
     try
     {
         Complex newComplex = Complex.Parse(s);
         result = newComplex;
         return(true);
     }
     catch (FormatException)
     {
         result = new Complex( );
         return(false);
     }
 }