Complex.Explicit Complex.Explicit Complex.Explicit Complex.Explicit Operator

定義

オーバーロード

Explicit(Decimal to Complex) Explicit(Decimal to Complex) Explicit(Decimal to Complex) Explicit(Decimal to Complex)

Decimal 値から複素数への明示的な型変換を定義します。Defines an explicit conversion of a Decimal value to a complex number.

Explicit(BigInteger to Complex) Explicit(BigInteger to Complex) Explicit(BigInteger to Complex) Explicit(BigInteger to Complex)

BigInteger 値から複素数への明示的な型変換を定義します。Defines an explicit conversion of a BigInteger value to a complex number.

Explicit(Decimal to Complex) Explicit(Decimal to Complex) Explicit(Decimal to Complex) Explicit(Decimal to Complex)

Decimal 値から複素数への明示的な型変換を定義します。Defines an explicit conversion of a Decimal value to a complex number.

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 Decimal Decimal Decimal

複素数に変換する値。The value to convert to a complex number.

戻り値

実数部が value で、虚数部が 0 である複素数。A complex number that has a real component equal to value and an imaginary component equal to zero.

次の例では、明示的な変換DecimalComplex値。The following example illustrates the explicit conversion of Decimal values to Complex values.

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オブジェクト。Explicit conversion operators define types that can be converted to a Complex object. 言語コンパイラはこの変換も実行しません自動的にデータの損失が生じる可能性があるためです。Language compilers do not perform this conversion automatically because it can involve data loss. (で C# の場合)、キャスト演算子または変換関数の場合にのみ変換を実行する代わりに、(などCTypeVisual Basic で) 使用されます。Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as CType in Visual Basic) is used. それ以外の場合、コンパイラ エラーが表示されます。Otherwise, they display a compiler error.

変換、Decimal複素数の実数部の値により、桁数が失われるため、 Double、複素数の値の型であるRealプロパティが有効桁数よりも少ない、Decimalします。The conversion of a Decimal value to the real part of a complex number can result in a loss of precision because a Double, which is the type of the complex number's Real property, has fewer significant digits than a Decimal.

Explicit(BigInteger to Complex) Explicit(BigInteger to Complex) Explicit(BigInteger to Complex) Explicit(BigInteger to Complex)

BigInteger 値から複素数への明示的な型変換を定義します。Defines an explicit conversion of a BigInteger value to a complex number.

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 BigInteger BigInteger BigInteger

複素数に変換する値。The value to convert to a complex number.

戻り値

実数部が value で、虚数部が 0 である複素数。A complex number that has a real component equal to value and an imaginary component equal to zero.

次の例では、明示的な変換BigIntegerComplex値。The following example illustrates the explicit conversion of BigInteger values to Complex values.

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オブジェクト。Explicit conversion operators define types that can be converted to a Complex object. 言語コンパイラはこの変換も実行しません自動的にデータの損失が生じる可能性があるためです。Language compilers do not perform this conversion automatically because it can involve data loss. (で C# の場合)、キャスト演算子または変換関数の場合にのみ変換を実行する代わりに、(などCTypeVisual Basic で) 使用されます。Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as CType in Visual Basic) is used. それ以外の場合、コンパイラ エラーが表示されます。Otherwise, they display a compiler error.

変換、BigInteger複素数の実数部の値により、桁数が失われるため、 Double、複素数の値の型であるRealプロパティが有効桁数よりも少ない、BigIntegerします。The conversion of a BigInteger value to the real part of a complex number can result in a loss of precision because a Double, which is the type of the complex number's Real property, has fewer significant digits than a BigInteger.

変換が成功しなかった場合ため、BigIntegerの範囲外の値は、Double型、操作はスローされません、OverflowExceptionします。If the conversion is unsuccessful because the BigInteger value is out of the range of the Double type, the operation does not throw an OverflowException. 代わりに場合、valueがより小さいMinValue、結果は、複素数の値を持つ、Realプロパティの値と等しいNegativeInfinityします。Instead, if value is less than MinValue, the result is a complex number that has a Real property value equal to NegativeInfinity. 場合valueがより大きいMaxValue、結果は、複素数の値を持つ、Realプロパティの値と等しいPositiveInfinityします。If value is greater than MaxValue, the result is a complex number that has a Real property value equal to PositiveInfinity.

適用対象