Complex.ImaginaryOne Mező
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Egy új Complex példányt ad vissza nullával egyenlő valós számmal és egy képzeletbeli számmal.
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
Mező értéke
Példák
Az alábbi példa egy Complex értéket példányosít a ImaginaryOne tulajdonság használatával. Ezután összehasonlítja ezt az értéket egy másik értékkel, amely a konstruktort nullával egyenlő valós részre és egy egy képzetes részre hívja Complex meg. Ahogy a példa kimenete is mutatja, a két érték egyenlő.
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