BigInteger.Implicit 運算子
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
定義了物件與其他類型之間的 BigInteger 隱含轉換。
多載
Implicit(UInt128 to BigInteger)
重要
此 API 不符合 CLS 規範。
隱含地將一個 UInt128 值轉換成一個大整數。
public:
static operator System::Numerics::BigInteger(UInt128 value);
[System.CLSCompliant(false)]
public static implicit operator System.Numerics.BigInteger(UInt128 value);
[<System.CLSCompliant(false)>]
static member op_Implicit : UInt128 -> System.Numerics.BigInteger
Public Shared Widening Operator CType (value As UInt128) As BigInteger
參數
- value
- UInt128
要轉換的值。
傳回
value 轉換成大整數。
- 屬性
適用於
Implicit(UIntPtr to BigInteger)
重要
此 API 不符合 CLS 規範。
隱含地將一個 UIntPtr 值轉換成一個大整數。
public:
static operator System::Numerics::BigInteger(UIntPtr value);
[System.CLSCompliant(false)]
public static implicit operator System.Numerics.BigInteger(UIntPtr value);
[<System.CLSCompliant(false)>]
static member op_Implicit : unativeint -> System.Numerics.BigInteger
Public Shared Widening Operator CType (value As UIntPtr) As BigInteger
參數
- value
-
UIntPtr
unativeint
要轉換的值。
傳回
value 轉換成大整數。
- 屬性
適用於
Implicit(UInt64 to BigInteger)
定義了將 64 位元無符號整數隱式轉換為某個 BigInteger 值的方法。
此 API 不符合 CLS 規範。 相容的替代方案為 Double。
public:
static operator System::Numerics::BigInteger(System::UInt64 value);
[System.CLSCompliant(false)]
public static implicit operator System.Numerics.BigInteger(ulong value);
[<System.CLSCompliant(false)>]
static member op_Implicit : uint64 -> System.Numerics.BigInteger
Public Shared Widening Operator CType (value As ULong) As BigInteger
參數
- value
- UInt64
將 轉換為 的值 BigInteger。
傳回
一個包含參數值 value 的物件。
- 屬性
備註
對於不支援隱式運算子的語言,另一種方法是 BigInteger.BigInteger(UInt64)。
方法 Implicit(Byte to BigInteger) 的多載定義了編譯器能自動轉換 BigInteger 值的類型,無需明確的鑄造運算子(在 C# 中)或呼叫轉換函式(在 Visual Basic 中)。 他們擴大了轉換,且不會涉及資料遺失,也不會拋出 OverflowException。 這種過載讓編譯器能處理從一個 UInt64 值轉換到另一個 BigInteger 值的過程,如下範例所示。
ulong uLongValue = 1358754982;
BigInteger number = uLongValue;
number = number * 2 - uLongValue;
Console.WriteLine(number * uLongValue / uLongValue); // Displays 1358754982
let uLongValue = 1358754982UL
let number = BigInteger(uLongValue)
let mutable number = BigInteger.Add(number, uLongValue / 2UL |> bigint)
printfn $"{number * bigint uLongValue / bigint uLongValue}" // Displays 1358754982
Dim uLongValue As ULong = 1358754982
Dim number As BigInteger = uLongValue
number = number * 2 - uLongValue
Console.WriteLine(number * uLongValue / uLongValue) ' Displays 1358754982
適用於
Implicit(UInt32 to BigInteger)
定義了將 32 位元無符號整數隱式轉換為某個 BigInteger 值的方法。
此 API 不符合 CLS 規範。 相容的替代方案為 Implicit(Int64 to BigInteger)。
public:
static operator System::Numerics::BigInteger(System::UInt32 value);
[System.CLSCompliant(false)]
public static implicit operator System.Numerics.BigInteger(uint value);
[<System.CLSCompliant(false)>]
static member op_Implicit : uint32 -> System.Numerics.BigInteger
Public Shared Widening Operator CType (value As UInteger) As BigInteger
參數
- value
- UInt32
將 轉換為 的值 BigInteger。
傳回
一個包含參數值 value 的物件。
- 屬性
備註
對於不支援隱式運算子的語言,另一種方法是 BigInteger.BigInteger(UInt32)。
方法 Implicit(Byte to BigInteger) 的多載定義了編譯器能自動轉換 BigInteger 值的類型,無需明確的鑄造運算子(在 C# 中)或呼叫轉換函式(在 Visual Basic 中)。 他們擴大了轉換,且不會涉及資料遺失,也不會拋出 OverflowException。 這種過載讓編譯器能處理從一個 UInt32 值轉換到另一個 BigInteger 值的過程,如下範例所示。
uint uIntValue = 65000;
BigInteger number = uIntValue;
number = BigInteger.Multiply(number, uIntValue);
Console.WriteLine(number == uIntValue); // Displays False
let uIntValue = 65000u
let number = BigInteger(uIntValue)
let mutable number = BigInteger.Multiply(number, uIntValue)
printfn $"{number = uIntValue}" // Displays "False
Dim uIntegerValue As UInteger = 65000
Dim number As BigInteger = uIntegerValue
number = BigInteger.Multiply(number, uIntegerValue)
Console.WriteLine(number = uIntegerValue) ' Displays False
適用於
Implicit(UInt16 to BigInteger)
定義了將 16 位元無符號整數隱式轉換為值 BigInteger 的方法。
此 API 不符合 CLS 規範。 相容的替代方案為 Implicit(Int32 to BigInteger)。
public:
static operator System::Numerics::BigInteger(System::UInt16 value);
[System.CLSCompliant(false)]
public static implicit operator System.Numerics.BigInteger(ushort value);
[<System.CLSCompliant(false)>]
static member op_Implicit : uint16 -> System.Numerics.BigInteger
Public Shared Widening Operator CType (value As UShort) As BigInteger
參數
- value
- UInt16
將 轉換為 的值 BigInteger。
傳回
一個包含參數值 value 的物件。
- 屬性
備註
對於不支援隱式運算子的語言,另一種方法是 BigInteger.BigInteger(UInt32)。
方法 Implicit(Byte to BigInteger) 的多載定義了編譯器能自動轉換 BigInteger 值的類型,無需明確的鑄造運算子(在 C# 中)或呼叫轉換函式(在 Visual Basic 中)。 他們擴大了轉換,且不會涉及資料遺失,也不會拋出 OverflowException。 這種過載讓編譯器能處理從一個 UInt16 值轉換到另一個 BigInteger 值的過程,如下範例所示。
ushort uShortValue = 25064;
BigInteger number = uShortValue;
number += uShortValue;
Console.WriteLine(number < uShortValue); // Displays False
let uShortValue = 25064us
let number = BigInteger(uShortValue)
let mutable number = BigInteger.Add(number, uShortValue)
printfn $"{number < uShortValue}" // Displays False
Dim uShortValue As UShort = 25064
Dim number As BigInteger = uShortValue
number += uShortValue
Console.WriteLine(number < uShortValue) ' Displays False
適用於
Implicit(SByte to BigInteger)
定義了將 8 位元有符號整數隱含轉換為某個 BigInteger 值的方法。
此 API 不符合 CLS 規範。 相容的替代方案為 BigInteger(Int32)。
public:
static operator System::Numerics::BigInteger(System::SByte value);
[System.CLSCompliant(false)]
public static implicit operator System.Numerics.BigInteger(sbyte value);
[<System.CLSCompliant(false)>]
static member op_Implicit : sbyte -> System.Numerics.BigInteger
Public Shared Widening Operator CType (value As SByte) As BigInteger
參數
- value
- SByte
將 轉換為 的值 BigInteger。
傳回
一個包含參數值 value 的物件。
- 屬性
備註
對於不支援隱式運算子的語言,另一種方法是 BigInteger.BigInteger(Int32)。
方法 Implicit(Byte to BigInteger) 的多載定義了編譯器能自動轉換 BigInteger 值的類型,無需明確的鑄造運算子(在 C# 中)或呼叫轉換函式(在 Visual Basic 中)。 他們擴大了轉換,且不會涉及資料遺失,也不會拋出 OverflowException。 這種過載讓編譯器能處理從一個 SByte 值轉換到另一個 BigInteger 值的過程,如下範例所示。
sbyte sByteValue = -12;
BigInteger number = BigInteger.Pow(sByteValue, 3);
Console.WriteLine(number < sByteValue); // Displays True
let sByteValue = -12y
let number = BigInteger.Pow(sByteValue, 3)
printfn $"{number < sByteValue}" // Displays True
Dim sByteValue As SByte = -12
Dim number As BigInteger = BigInteger.Pow(sByteValue, 3)
Console.WriteLine(number < sByteValue) ' Displays True
適用於
Implicit(Int32 to BigInteger)
定義了將有號32位元整數隱式轉換為某個 BigInteger 值的方法。
public:
static operator System::Numerics::BigInteger(int value);
public static implicit operator System.Numerics.BigInteger(int value);
static member op_Implicit : int -> System.Numerics.BigInteger
Public Shared Widening Operator CType (value As Integer) As BigInteger
參數
- value
- Int32
將 轉換為 的值 BigInteger。
傳回
一個包含參數值 value 的物件。
備註
對於不支援隱式運算子的語言,另一種方法是 BigInteger.BigInteger(Int32)。
方法 Implicit(Byte to BigInteger) 的多載定義了編譯器能自動轉換 BigInteger 值的類型,無需明確的鑄造運算子(在 C# 中)或呼叫轉換函式(在 Visual Basic 中)。 他們擴大了轉換,且不會涉及資料遺失,也不會拋出 OverflowException。 這種過載讓編譯器能處理從一個 Int32 值轉換到另一個 BigInteger 值的過程,如下範例所示。
int intValue = 65000;
BigInteger number = intValue;
number = BigInteger.Multiply(number, intValue);
Console.WriteLine(number == intValue); // Displays False
let intValue = 65000
let number = BigInteger(intValue)
let mutable number = BigInteger.Multiply(number, intValue)
printfn $"{number = intValue}" // Displays False
Dim integerValue As Integer = 65000
Dim number As BigInteger = integerValue
number = BigInteger.Multiply(number, integerValue)
Console.WriteLine(number = integerValue) ' Displays False
適用於
Implicit(Int64 to BigInteger)
定義了將有符號的 64 位元整數隱式轉換為值 BigInteger 的方法。
public:
static operator System::Numerics::BigInteger(long value);
public static implicit operator System.Numerics.BigInteger(long value);
static member op_Implicit : int64 -> System.Numerics.BigInteger
Public Shared Widening Operator CType (value As Long) As BigInteger
參數
- value
- Int64
將 轉換為 的值 BigInteger。
傳回
一個包含參數值 value 的物件。
備註
對於不支援隱式運算子的語言,另一種方法是 BigInteger.BigInteger(Int64)。
方法 Implicit(Byte to BigInteger) 的多載定義了編譯器能自動轉換 BigInteger 值的類型,無需明確的鑄造運算子(在 C# 中)或呼叫轉換函式(在 Visual Basic 中)。 他們擴大了轉換,且不會涉及資料遺失,也不會拋出 OverflowException。 這種過載讓編譯器能處理從一個 Int64 值轉換到另一個 BigInteger 值的過程,如下範例所示。
long longValue = 1358754982;
BigInteger number = longValue;
number = number + (longValue / 2);
Console.WriteLine(number * longValue / longValue); // Displays 2038132473
let longValue = 1358754982L
let number = BigInteger longValue
let mutable number = BigInteger.Add(number, longValue / 2L |> bigint)
printfn $"{((number * bigint longValue) / (bigint longValue))}" // Displays 2038132473
Dim longValue As Long = 1358754982
Dim number As BigInteger = longValue
number = number + (longValue \ 2)
Console.WriteLine(number * longValue / longValue) ' Displays 2038132473
適用於
Implicit(IntPtr to BigInteger)
隱含地將一個 IntPtr 值轉換成一個大整數。
public:
static operator System::Numerics::BigInteger(IntPtr value);
public static implicit operator System.Numerics.BigInteger(IntPtr value);
static member op_Implicit : nativeint -> System.Numerics.BigInteger
Public Shared Widening Operator CType (value As IntPtr) As BigInteger
參數
- value
-
IntPtr
nativeint
要轉換的值。
傳回
value 轉換成大整數。
適用於
Implicit(Int16 to BigInteger)
定義了將有號的 16 位元整數隱式轉換為某個 BigInteger 值的方法。
public:
static operator System::Numerics::BigInteger(short value);
public static implicit operator System.Numerics.BigInteger(short value);
static member op_Implicit : int16 -> System.Numerics.BigInteger
Public Shared Widening Operator CType (value As Short) As BigInteger
參數
- value
- Int16
將 轉換為 的值 BigInteger。
傳回
一個包含參數值 value 的物件。
備註
對於不支援隱式運算子的語言,另一種方法是 BigInteger.BigInteger(Int32)。
方法 Implicit(Byte to BigInteger) 的多載定義了編譯器能自動轉換 BigInteger 值的類型,無需明確的鑄造運算子(在 C# 中)或呼叫轉換函式(在 Visual Basic 中)。 他們擴大了轉換,且不會涉及資料遺失,也不會拋出 OverflowException。 這種過載讓編譯器能處理從一個 Int16 值轉換到另一個 BigInteger 值的過程,如下範例所示。
short shortValue = 25064;
BigInteger number = shortValue;
number += shortValue;
Console.WriteLine(number < shortValue); // Displays False
let shortValue = 25064s
let number = BigInteger(shortValue)
let mutable number = BigInteger.Add(number, shortValue)
printfn $"{number > shortValue}" // Displays False
Dim shortValue As Short = 25064
Dim number As BigInteger = shortValue
number += shortValue
Console.WriteLine(number < shortValue) ' Displays False
適用於
Implicit(Int128 to BigInteger)
隱含地將一個 Int128 值轉換成一個大整數。
public:
static operator System::Numerics::BigInteger(Int128 value);
public static implicit operator System.Numerics.BigInteger(Int128 value);
static member op_Implicit : Int128 -> System.Numerics.BigInteger
Public Shared Widening Operator CType (value As Int128) As BigInteger
參數
- value
- Int128
要轉換的值。
傳回
value 轉換成大整數。
適用於
Implicit(Char to BigInteger)
隱含地將一個 Char 值轉換成一個大整數。
public:
static operator System::Numerics::BigInteger(char value);
public static implicit operator System.Numerics.BigInteger(char value);
static member op_Implicit : char -> System.Numerics.BigInteger
Public Shared Widening Operator CType (value As Char) As BigInteger
參數
- value
- Char
要轉換的值。
傳回
value 轉換成大整數。
適用於
Implicit(Byte to BigInteger)
定義了將未簽名位元組隱式轉換為值 BigInteger 的方法。
public:
static operator System::Numerics::BigInteger(System::Byte value);
public static implicit operator System.Numerics.BigInteger(byte value);
static member op_Implicit : byte -> System.Numerics.BigInteger
Public Shared Widening Operator CType (value As Byte) As BigInteger
參數
- value
- Byte
將 轉換為 的值 BigInteger。
傳回
一個包含參數值 value 的物件。
備註
參數中 value 任意的分數部分在轉換前會被截斷。
對於不支援隱式運算子的語言,另一種方法是 BigInteger.BigInteger(Int32)。
方法 Implicit(Byte to BigInteger) 的多載定義了編譯器能自動轉換 BigInteger 值的類型,無需明確的鑄造運算子(在 C# 中)或呼叫轉換函式(在 Visual Basic 中)。 他們擴大了轉換,且不會涉及資料遺失,也不會拋出 OverflowException。 這種過載讓編譯器能處理從一個 Byte 值轉換到另一個 BigInteger 值的過程,如下範例所示。
byte byteValue = 254;
BigInteger number = byteValue;
number = BigInteger.Add(number, byteValue);
Console.WriteLine(number > byteValue); // Displays True
let byteValue = 254uy
let number = BigInteger(byteValue)
let mutable number = BigInteger.Add(number, byteValue)
printfn $"{number > byteValue}" // Displays True
Dim byteValue As Byte = 254
Dim number As BigInteger = byteValue
number = BigInteger.Add(number, byteValue)
Console.WriteLine(number > byteValue) ' Displays True