Complex.Explicit 演算子

定義

Complex オブジェクトと別の型の間の明示的な変換を定義します。

オーバーロード

Explicit(UInt128 to Complex)

値を UInt128 倍精度複素数に明示的に変換します。

Explicit(BigInteger to Complex)

BigInteger 値から複素数への明示的な型変換を定義します。

Explicit(Decimal to Complex)

Decimal 値から複素数への明示的な型変換を定義します。

Explicit(Int128 to Complex)

値を Int128 倍精度複素数に明示的に変換します。

Explicit(UInt128 to Complex)

ソース:
Complex.cs
ソース:
Complex.cs
ソース:
Complex.cs

重要

この API は CLS 準拠ではありません。

値を UInt128 倍精度複素数に明示的に変換します。

public:
 static explicit operator System::Numerics::Complex(UInt128 value);
[System.CLSCompliant(false)]
public static explicit operator System.Numerics.Complex (UInt128 value);
[<System.CLSCompliant(false)>]
static member op_Explicit : UInt128 -> System.Numerics.Complex
Public Shared Narrowing Operator CType (value As UInt128) As Complex

パラメーター

value
UInt128

変換する値。

戻り値

value 倍精度複素数に変換されます。

属性

適用対象

Explicit(BigInteger to Complex)

ソース:
Complex.cs
ソース:
Complex.cs
ソース:
Complex.cs

BigInteger 値から複素数への明示的な型変換を定義します。

public:
 static explicit operator System::Numerics::Complex(System::Numerics::BigInteger value);
public static explicit operator System.Numerics.Complex (System.Numerics.BigInteger value);
static member op_Explicit : System.Numerics.BigInteger -> System.Numerics.Complex
Public Shared Narrowing Operator CType (value As BigInteger) As Complex

パラメーター

value
BigInteger

複素数に変換する値。

戻り値

実数部が value で、虚数部が 0 である複素数。

次の例は、値から値への明示的な変換 BigIntegerComplex 示しています。

BigInteger[] numbers= {
                 ((BigInteger) Double.MaxValue) * 2,
                 BigInteger.Parse("901345277852317852466891423"),
                 BigInteger.One };
foreach (BigInteger number in numbers)
{
  Complex c1 = (Complex) number;
   Console.WriteLine(c1);
}
// The example displays the following output:
//       (Infinity, 0)
//       (9.01345277852318E+26, 0)
//       (1, 0)
Dim numbers() As BigInteger = {
                 CType(Double.MaxValue, BigInteger) * 2, 
                 BigInteger.Parse("901345277852317852466891423"), 
                 BigInteger.One } 
For Each number In numbers
  Dim c1 As System.Numerics.Complex = CType(number, 
                                    System.Numerics.Complex)
   Console.WriteLine(c1)
Next        
' The example displays the following output:
'       (Infinity, 0)
'       (9.01345277852318E+26, 0)
'       (1, 0)

注釈

明示的な変換演算子は、オブジェクトに変換できる型を Complex 定義します。 言語コンパイラは、データ損失を伴う可能性があるため、この変換を自動的に実行しません。 代わりに、キャスト演算子 (C#) または変換関数 (Visual Basic など CType ) が使用されている場合にのみ、変換を実行します。 それ以外の場合は、コンパイラ エラーが表示されます。

複素数の実際のBigInteger部分に値を変換すると、複素数のプロパティの型Realである が よりも有効桁数BigIntegerが少ないためDouble、精度が失われる可能性があります。

値が型の範囲外であるために BigInteger 変換が失敗した Double 場合、操作は を OverflowExceptionスローしません。 代わりに、 が よりMinValue小さい場合value、結果は と等しいNegativeInfinityプロパティ値をReal持つ複素数になります。 が よりMaxValue大きい場合value、結果は と等しいPositiveInfinityプロパティ値をReal持つ複素数になります。

適用対象

Explicit(Decimal to Complex)

ソース:
Complex.cs
ソース:
Complex.cs
ソース:
Complex.cs

Decimal 値から複素数への明示的な型変換を定義します。

public:
 static explicit operator System::Numerics::Complex(System::Decimal value);
public static explicit operator System.Numerics.Complex (decimal value);
static member op_Explicit : decimal -> System.Numerics.Complex
Public Shared Narrowing Operator CType (value As Decimal) As Complex

パラメーター

value
Decimal

複素数に変換する値。

戻り値

実数部が value で、虚数部が 0 である複素数。

次の例は、値から値への明示的な変換 DecimalComplex 示しています。

decimal[] numbers = { Decimal.MinValue, -18.35m, 0m, 1893.019m,
                      Decimal.MaxValue };
foreach (decimal number in numbers)
{
   System.Numerics.Complex c1 = (System.Numerics.Complex) number;
   Console.WriteLine("{0,30}  -->  {1}", number, c1);
}
// The example displays the following output:
//    -79228162514264337593543950335  -->  (-7.92281625142643E+28, 0)
//                            -18.35  -->  (-18.35, 0)
//                                 0  -->  (0, 0)
//                          1893.019  -->  (1893.019, 0)
//     79228162514264337593543950335  -->  (7.92281625142643E+28, 0)
Dim numbers() As Decimal = { Decimal.MinValue, -18.35d, 0d, 1893.019d, 
                             Decimal.MaxValue }
For Each number In numbers
   Dim c1 As System.Numerics.Complex = CType(number, 
                                             System.Numerics.Complex)
   Console.WriteLine("{0,30}  -->  {1}", number, c1)
Next   
' The example displays the following output:
'    -79228162514264337593543950335  -->  (-7.92281625142643E+28, 0)
'                            -18.35  -->  (-18.3500003814697, 0)
'                                 0  -->  (0, 0)
'                          1893.019  -->  (1893.01904296875, 0)
'     79228162514264337593543950335  -->  (7.92281625142643E+28, 0)

注釈

明示的な変換演算子は、オブジェクトに変換できる型を Complex 定義します。 言語コンパイラは、データ損失を伴う可能性があるため、この変換を自動的に実行しません。 代わりに、キャスト演算子 (C#) または変換関数 (Visual Basic など CType ) が使用されている場合にのみ、変換を実行します。 それ以外の場合は、コンパイラ エラーが表示されます。

複素数の実際のDecimal部分に値を変換すると、複素数のプロパティの型Realである が よりも有効桁数Decimalが少ないためDouble、精度が失われる可能性があります。

適用対象

Explicit(Int128 to Complex)

ソース:
Complex.cs
ソース:
Complex.cs
ソース:
Complex.cs

値を Int128 倍精度複素数に明示的に変換します。

public:
 static explicit operator System::Numerics::Complex(Int128 value);
public static explicit operator System.Numerics.Complex (Int128 value);
static member op_Explicit : Int128 -> System.Numerics.Complex
Public Shared Narrowing Operator CType (value As Int128) As Complex

パラメーター

value
Int128

変換する値。

戻り値

value 倍精度複素数に変換されます。

適用対象