Complex.Zero Fält

Definition

Returnerar en ny Complex instans med ett verkligt tal som är lika med noll och ett imaginärt tal som är lika med noll.

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

Fältvärde

Exempel

I följande exempel instansieras ett Complex värde med hjälp av egenskapen Zero . Sedan jämförs det här värdet med ett annat värde som instansieras genom att anropa Complex konstruktorn med en verklig del som är lika med noll och en imaginär del som är lika med noll. Som utdata från exemplet visar är de två värdena lika.

using System;
using System.Numerics;

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

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

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

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

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

Kommentarer

Egenskapen Zero används oftast för att jämföra ett Complex värde med noll.

Gäller för

Se även