Complex.One 字段

定义

返回新的 Complex 实例,其实数等于一,虚数等于零。

public: static initonly System::Numerics::Complex One;
public static readonly System.Numerics.Complex One;
 staticval mutable One : System.Numerics.Complex
Public Shared ReadOnly One As Complex 

字段值

示例

以下示例使用 One 属性实例化Complex值。 然后,它将此值与另一个值进行比较,该值通过调用 Complex 实部等于 1 且虚部分等于零的构造函数实例化。 如示例输出所示,两个值相等。

using System;
using System.Numerics;

public class Example
{
   public static void Main()
   {
      Complex value = Complex.One;
      Console.WriteLine(value.ToString());

      // Instantiate a complex number with real part 1 and imaginary part 0.
      Complex value1 = new Complex(1, 0);
      Console.WriteLine(value.Equals(value1));
   }
}
// The example displays the following output:
//       (1, 0)
//       True
open System.Numerics

let value = Complex.One
printfn $"{value}"

// Instantiate a complex number with real part 1 and imaginary part 0.
let value1 = Complex(1., 0.)
printfn $"{value.Equals value1}"
// The example displays the following output:
//       (1, 0)
//       True
Imports System.Numerics

Module Example
   Public Sub Main()
      Dim value As Complex = Complex.One
      Console.WriteLine(value.ToString())
      
      ' Instantiate a complex number with real part 1 and imaginary part 0.
      Dim value1 As New Complex(1, 0)
      Console.WriteLine(value.Equals(value1))
   End Sub
End Module
' The example displays the following output:
'       (1, 0)
'       True

适用于

另请参阅