Complex.ImaginaryOne 欄位
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在實數等於零且虛數等於一條件下,傳回新 Complex 執行個體。
public: static initonly System::Numerics::Complex ImaginaryOne;
public static readonly System.Numerics.Complex ImaginaryOne;
staticval mutable ImaginaryOne : System.Numerics.Complex
Public Shared ReadOnly ImaginaryOne As Complex
欄位值
範例
下列範例會使用 ImaginaryOne 屬性具Complex現化值。 然後,它會將此值與另一個值進行比較,方法是呼叫 Complex 實數等於零且虛數部分等於一的建構函式來具現化。 如範例的輸出所示,這兩個值相等。
using System;
using System.Numerics;
public class Example
{
public static void Main()
{
Complex value = Complex.ImaginaryOne;
Console.WriteLine(value.ToString());
// Instantiate a complex number with real part 0 and imaginary part 1.
Complex value1 = new Complex(0, 1);
Console.WriteLine(value.Equals(value1));
}
}
// The example displays the following output:
// (0, 1)
// True
open System.Numerics
let value = Complex.ImaginaryOne
printfn $"{value}"
// Instantiate a complex number with real part 0 and imaginary part 1.
let value1 = Complex(0., 1.)
printfn $"{value.Equals value1}"
// The example displays the following output:
// (0, 1)
// True
Imports System.Numerics
Module Example
Public Sub Main()
Dim value As Complex = Complex.ImaginaryOne
Console.WriteLine(value.ToString())
' Instantiate a complex number with real part 0 and imaginary part 1.
Dim value1 As New Complex(0, 1)
Console.WriteLine(value.Equals(value1))
End Sub
End Module
' The example displays the following output:
' (0, 1)
' True