Int64 Struct
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Rappresenta un intero con segno a 64 bit.
public value class long : IComparable, IComparable<long>, IConvertible, IEquatable<long>, IFormattable
public value class long : IComparable<long>, IConvertible, IEquatable<long>, IParsable<long>, ISpanParsable<long>, IUtf8SpanParsable<long>, System::Numerics::IAdditionOperators<long, long, long>, System::Numerics::IAdditiveIdentity<long, long>, System::Numerics::IBinaryInteger<long>, System::Numerics::IBinaryNumber<long>, System::Numerics::IBitwiseOperators<long, long, long>, System::Numerics::IComparisonOperators<long, long, bool>, System::Numerics::IDecrementOperators<long>, System::Numerics::IDivisionOperators<long, long, long>, System::Numerics::IEqualityOperators<long, long, bool>, System::Numerics::IIncrementOperators<long>, System::Numerics::IMinMaxValue<long>, System::Numerics::IModulusOperators<long, long, long>, System::Numerics::IMultiplicativeIdentity<long, long>, System::Numerics::IMultiplyOperators<long, long, long>, System::Numerics::INumber<long>, System::Numerics::INumberBase<long>, System::Numerics::IShiftOperators<long, int, long>, System::Numerics::ISignedNumber<long>, System::Numerics::ISubtractionOperators<long, long, long>, System::Numerics::IUnaryNegationOperators<long, long>, System::Numerics::IUnaryPlusOperators<long, long>
public value class long : IComparable, IComparable<long>, IConvertible, IEquatable<long>, ISpanFormattable
public value class long : IComparable<long>, IConvertible, IEquatable<long>, IParsable<long>, ISpanParsable<long>, System::Numerics::IAdditionOperators<long, long, long>, System::Numerics::IAdditiveIdentity<long, long>, System::Numerics::IBinaryInteger<long>, System::Numerics::IBinaryNumber<long>, System::Numerics::IBitwiseOperators<long, long, long>, System::Numerics::IComparisonOperators<long, long, bool>, System::Numerics::IDecrementOperators<long>, System::Numerics::IDivisionOperators<long, long, long>, System::Numerics::IEqualityOperators<long, long, bool>, System::Numerics::IIncrementOperators<long>, System::Numerics::IMinMaxValue<long>, System::Numerics::IModulusOperators<long, long, long>, System::Numerics::IMultiplicativeIdentity<long, long>, System::Numerics::IMultiplyOperators<long, long, long>, System::Numerics::INumber<long>, System::Numerics::INumberBase<long>, System::Numerics::IShiftOperators<long, int, long>, System::Numerics::ISignedNumber<long>, System::Numerics::ISubtractionOperators<long, long, long>, System::Numerics::IUnaryNegationOperators<long, long>, System::Numerics::IUnaryPlusOperators<long, long>
public value class long : IComparable, IConvertible, IFormattable
public value class long : IComparable, IComparable<long>, IEquatable<long>, IFormattable
public struct Int64 : IComparable, IComparable<long>, IConvertible, IEquatable<long>, IFormattable
public readonly struct Int64 : IComparable<long>, IConvertible, IEquatable<long>, IParsable<long>, ISpanParsable<long>, IUtf8SpanParsable<long>, System.Numerics.IAdditionOperators<long,long,long>, System.Numerics.IAdditiveIdentity<long,long>, System.Numerics.IBinaryInteger<long>, System.Numerics.IBinaryNumber<long>, System.Numerics.IBitwiseOperators<long,long,long>, System.Numerics.IComparisonOperators<long,long,bool>, System.Numerics.IDecrementOperators<long>, System.Numerics.IDivisionOperators<long,long,long>, System.Numerics.IEqualityOperators<long,long,bool>, System.Numerics.IIncrementOperators<long>, System.Numerics.IMinMaxValue<long>, System.Numerics.IModulusOperators<long,long,long>, System.Numerics.IMultiplicativeIdentity<long,long>, System.Numerics.IMultiplyOperators<long,long,long>, System.Numerics.INumber<long>, System.Numerics.INumberBase<long>, System.Numerics.IShiftOperators<long,int,long>, System.Numerics.ISignedNumber<long>, System.Numerics.ISubtractionOperators<long,long,long>, System.Numerics.IUnaryNegationOperators<long,long>, System.Numerics.IUnaryPlusOperators<long,long>
public readonly struct Int64 : IComparable, IComparable<long>, IConvertible, IEquatable<long>, IFormattable
public readonly struct Int64 : IComparable, IComparable<long>, IConvertible, IEquatable<long>, ISpanFormattable
public readonly struct Int64 : IComparable<long>, IConvertible, IEquatable<long>, IParsable<long>, ISpanParsable<long>, System.Numerics.IAdditionOperators<long,long,long>, System.Numerics.IAdditiveIdentity<long,long>, System.Numerics.IBinaryInteger<long>, System.Numerics.IBinaryNumber<long>, System.Numerics.IBitwiseOperators<long,long,long>, System.Numerics.IComparisonOperators<long,long,bool>, System.Numerics.IDecrementOperators<long>, System.Numerics.IDivisionOperators<long,long,long>, System.Numerics.IEqualityOperators<long,long,bool>, System.Numerics.IIncrementOperators<long>, System.Numerics.IMinMaxValue<long>, System.Numerics.IModulusOperators<long,long,long>, System.Numerics.IMultiplicativeIdentity<long,long>, System.Numerics.IMultiplyOperators<long,long,long>, System.Numerics.INumber<long>, System.Numerics.INumberBase<long>, System.Numerics.IShiftOperators<long,int,long>, System.Numerics.ISignedNumber<long>, System.Numerics.ISubtractionOperators<long,long,long>, System.Numerics.IUnaryNegationOperators<long,long>, System.Numerics.IUnaryPlusOperators<long,long>
[System.Serializable]
public struct Int64 : IComparable, IConvertible, IFormattable
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public struct Int64 : IComparable, IComparable<long>, IConvertible, IEquatable<long>, IFormattable
public struct Int64 : IComparable, IComparable<long>, IEquatable<long>, IFormattable
type int64 = struct
interface IConvertible
interface IFormattable
type int64 = struct
interface IConvertible
interface IFormattable
interface IParsable<int64>
interface ISpanFormattable
interface ISpanParsable<int64>
interface IUtf8SpanFormattable
interface IUtf8SpanParsable<int64>
interface IAdditionOperators<int64, int64, int64>
interface IAdditiveIdentity<int64, int64>
interface IBinaryInteger<int64>
interface IBinaryNumber<int64>
interface IBitwiseOperators<int64, int64, int64>
interface IComparisonOperators<int64, int64, bool>
interface IEqualityOperators<int64, int64, bool>
interface IDecrementOperators<int64>
interface IDivisionOperators<int64, int64, int64>
interface IIncrementOperators<int64>
interface IModulusOperators<int64, int64, int64>
interface IMultiplicativeIdentity<int64, int64>
interface IMultiplyOperators<int64, int64, int64>
interface INumber<int64>
interface INumberBase<int64>
interface ISubtractionOperators<int64, int64, int64>
interface IUnaryNegationOperators<int64, int64>
interface IUnaryPlusOperators<int64, int64>
interface IShiftOperators<int64, int, int64>
interface IMinMaxValue<int64>
interface ISignedNumber<int64>
type int64 = struct
interface IConvertible
interface ISpanFormattable
interface IFormattable
type int64 = struct
interface IConvertible
interface IFormattable
interface IParsable<int64>
interface ISpanFormattable
interface ISpanParsable<int64>
interface IAdditionOperators<int64, int64, int64>
interface IAdditiveIdentity<int64, int64>
interface IBinaryInteger<int64>
interface IBinaryNumber<int64>
interface IBitwiseOperators<int64, int64, int64>
interface IComparisonOperators<int64, int64, bool>
interface IEqualityOperators<int64, int64, bool>
interface IDecrementOperators<int64>
interface IDivisionOperators<int64, int64, int64>
interface IIncrementOperators<int64>
interface IModulusOperators<int64, int64, int64>
interface IMultiplicativeIdentity<int64, int64>
interface IMultiplyOperators<int64, int64, int64>
interface INumber<int64>
interface INumberBase<int64>
interface ISubtractionOperators<int64, int64, int64>
interface IUnaryNegationOperators<int64, int64>
interface IUnaryPlusOperators<int64, int64>
interface IShiftOperators<int64, int, int64>
interface IMinMaxValue<int64>
interface ISignedNumber<int64>
type int64 = struct
interface IConvertible
interface IFormattable
interface IParsable<int64>
interface ISpanFormattable
interface ISpanParsable<int64>
interface IAdditionOperators<int64, int64, int64>
interface IAdditiveIdentity<int64, int64>
interface IBinaryInteger<int64>
interface IBinaryNumber<int64>
interface IBitwiseOperators<int64, int64, int64>
interface IComparisonOperators<int64, int64, bool>
interface IEqualityOperators<int64, int64, bool>
interface IDecrementOperators<int64>
interface IDivisionOperators<int64, int64, int64>
interface IIncrementOperators<int64>
interface IModulusOperators<int64, int64, int64>
interface IMultiplicativeIdentity<int64, int64>
interface IMultiplyOperators<int64, int64, int64>
interface INumber<int64>
interface INumberBase<int64>
interface ISubtractionOperators<int64, int64, int64>
interface IUnaryNegationOperators<int64, int64>
interface IUnaryPlusOperators<int64, int64>
interface IUtf8SpanFormattable
interface IUtf8SpanParsable<int64>
interface IShiftOperators<int64, int, int64>
interface IMinMaxValue<int64>
interface ISignedNumber<int64>
[<System.Serializable>]
type int64 = struct
interface IFormattable
interface IConvertible
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type int64 = struct
interface IFormattable
interface IConvertible
type int64 = struct
interface IFormattable
Public Structure Int64
Implements IComparable, IComparable(Of Long), IConvertible, IEquatable(Of Long), IFormattable
Public Structure Int64
Implements IAdditionOperators(Of Long, Long, Long), IAdditiveIdentity(Of Long, Long), IBinaryInteger(Of Long), IBinaryNumber(Of Long), IBitwiseOperators(Of Long, Long, Long), IComparable(Of Long), IComparisonOperators(Of Long, Long, Boolean), IConvertible, IDecrementOperators(Of Long), IDivisionOperators(Of Long, Long, Long), IEqualityOperators(Of Long, Long, Boolean), IEquatable(Of Long), IIncrementOperators(Of Long), IMinMaxValue(Of Long), IModulusOperators(Of Long, Long, Long), IMultiplicativeIdentity(Of Long, Long), IMultiplyOperators(Of Long, Long, Long), INumber(Of Long), INumberBase(Of Long), IParsable(Of Long), IShiftOperators(Of Long, Integer, Long), ISignedNumber(Of Long), ISpanParsable(Of Long), ISubtractionOperators(Of Long, Long, Long), IUnaryNegationOperators(Of Long, Long), IUnaryPlusOperators(Of Long, Long), IUtf8SpanParsable(Of Long)
Public Structure Int64
Implements IComparable, IComparable(Of Long), IConvertible, IEquatable(Of Long), ISpanFormattable
Public Structure Int64
Implements IAdditionOperators(Of Long, Long, Long), IAdditiveIdentity(Of Long, Long), IBinaryInteger(Of Long), IBinaryNumber(Of Long), IBitwiseOperators(Of Long, Long, Long), IComparable(Of Long), IComparisonOperators(Of Long, Long, Boolean), IConvertible, IDecrementOperators(Of Long), IDivisionOperators(Of Long, Long, Long), IEqualityOperators(Of Long, Long, Boolean), IEquatable(Of Long), IIncrementOperators(Of Long), IMinMaxValue(Of Long), IModulusOperators(Of Long, Long, Long), IMultiplicativeIdentity(Of Long, Long), IMultiplyOperators(Of Long, Long, Long), INumber(Of Long), INumberBase(Of Long), IParsable(Of Long), IShiftOperators(Of Long, Integer, Long), ISignedNumber(Of Long), ISpanParsable(Of Long), ISubtractionOperators(Of Long, Long, Long), IUnaryNegationOperators(Of Long, Long), IUnaryPlusOperators(Of Long, Long)
Public Structure Int64
Implements IComparable, IConvertible, IFormattable
Public Structure Int64
Implements IComparable, IComparable(Of Long), IEquatable(Of Long), IFormattable
- Ereditarietà
- Attributi
- Implementazioni
-
IComparable IComparable<Int64> IConvertible IEquatable<Int64> IFormattable IComparable<TSelf> IEquatable<TSelf> IParsable<Int64> IParsable<TSelf> ISpanFormattable ISpanParsable<Int64> ISpanParsable<TSelf> IUtf8SpanFormattable IUtf8SpanParsable<Int64> IUtf8SpanParsable<TSelf> IAdditionOperators<Int64,Int64,Int64> IAdditionOperators<TSelf,TSelf,TSelf> IAdditiveIdentity<Int64,Int64> IAdditiveIdentity<TSelf,TSelf> IBinaryInteger<Int64> IBinaryNumber<Int64> IBinaryNumber<TSelf> IBitwiseOperators<Int64,Int64,Int64> IBitwiseOperators<TSelf,TSelf,TSelf> IComparisonOperators<Int64,Int64,Boolean> IComparisonOperators<TSelf,TSelf,Boolean> IDecrementOperators<Int64> IDecrementOperators<TSelf> IDivisionOperators<Int64,Int64,Int64> IDivisionOperators<TSelf,TSelf,TSelf> IEqualityOperators<Int64,Int64,Boolean> IEqualityOperators<TSelf,TOther,TResult> IEqualityOperators<TSelf,TSelf,Boolean> IIncrementOperators<Int64> IIncrementOperators<TSelf> IMinMaxValue<Int64> IModulusOperators<Int64,Int64,Int64> IModulusOperators<TSelf,TSelf,TSelf> IMultiplicativeIdentity<Int64,Int64> IMultiplicativeIdentity<TSelf,TSelf> IMultiplyOperators<Int64,Int64,Int64> IMultiplyOperators<TSelf,TSelf,TSelf> INumber<Int64> INumber<TSelf> INumberBase<Int64> INumberBase<TSelf> IShiftOperators<Int64,Int32,Int64> IShiftOperators<TSelf,Int32,TSelf> ISignedNumber<Int64> ISubtractionOperators<Int64,Int64,Int64> ISubtractionOperators<TSelf,TSelf,TSelf> IUnaryNegationOperators<Int64,Int64> IUnaryNegationOperators<TSelf,TSelf> IUnaryPlusOperators<Int64,Int64> IUnaryPlusOperators<TSelf,TSelf>
Commenti
Int64 è un tipo di valore non modificabile che rappresenta interi con segno con valori compresi tra -9.223.372.036.854.775.808 (rappresentato dalla costante Int64.MinValue) e 9.223.372.036.854.775.807 (rappresentato dalla costante Int64.MaxValue). .NET include anche un tipo valore intero senza segno a 64 bit, UInt64, che rappresenta i valori compresi tra 0 e 18.446.744.073.709.551.615.
Creare un'istanza di un valore Int64
È possibile creare un'istanza di valore Int64 in diversi modi:
È possibile dichiarare una Int64 variabile e assegnargli un valore intero letterale compreso nell'intervallo del Int64 tipo di dati. L'esempio seguente dichiara due variabili Int64 e assegna loro dei valori in questo modo.
long number1 = -64301728; long number2 = 255486129307;let number1 = -64301728L let number2 = 255486129307LDim number1 As Long = -64301728 Dim number2 As Long = 255486129307È possibile assegnare il valore di un tipo integrale il cui intervallo è un subset del Int64 tipo. Si tratta di una conversione più ampia che non richiede un operatore cast in C# o un metodo di conversione in Visual Basic. In F#, solo il Int32 tipo può essere ampliato automaticamente.
sbyte value1 = 124; short value2 = 1618; int value3 = Int32.MaxValue; long number1 = value1; long number2 = value2; long number3 = value3;let value1 = 124y let value2 = 1618s let value3 = Int32.MaxValue let number1 = int64 value1 let number2 = int64 value2 let number3: int64 = value3Dim value1 As SByte = 124 Dim value2 As Int16 = 1618 Dim value3 As Int32 = Int32.MaxValue Dim number1 As Long = value1 Dim number2 As Long = value2 Dim number3 As Long = value3È possibile assegnare il valore di un tipo numerico il cui intervallo supera quello del Int64 tipo. Si tratta di una conversione di tipo narrowing, quindi richiede un operatore cast in C# o F# e un metodo di conversione in Visual Basic, se
Option Strictè attivo. Se il valore numerico è un Singlevalore , Doubleo Decimal che include un componente frazionaria, la gestione della relativa parte frazionaria dipende dal compilatore che esegue la conversione. Nell'esempio seguente vengono eseguite conversioni di tipo narrowing per assegnare diversi valori numerici alle Int64 variabili.ulong ulNumber = 163245617943825; try { long number1 = (long) ulNumber; Console.WriteLine(number1); } catch (OverflowException) { Console.WriteLine($"{ulNumber} is out of range of an Int64."); } double dbl2 = 35901.997; try { long number2 = (long) dbl2; Console.WriteLine(number2); } catch (OverflowException) { Console.WriteLine($"{dbl2} is out of range of an Int64."); } BigInteger bigNumber = (BigInteger) 1.63201978555e30; try { long number3 = (long) bigNumber; Console.WriteLine(number3); } catch (OverflowException) { Console.WriteLine($"{bigNumber} is out of range of an Int64."); } // The example displays the following output: // 163245617943825 // 35902 // 1,632,019,785,549,999,969,612,091,883,520 is out of range of an Int64.let ulNumber = 163245617943825uL try let number1 = int64 ulNumber printfn $"{number1}" with :? OverflowException -> printfn $"{ulNumber} is out of range of an Int64." let dbl2 = 35901.997 try let number2 = int64 dbl2 printfn $"{number2}" with :? OverflowException -> printfn $"{dbl2} is out of range of an Int64." let bigNumber = BigInteger 1.63201978555e30 try let number3 = int64 bigNumber printfn $"{number3}" with :? OverflowException -> printfn $"{bigNumber} is out of range of an Int64." // The example displays the following output: // 163245617943825 // 35902 // 1,632,019,785,549,999,969,612,091,883,520 is out of range of an Int64.Dim ulNumber As ULong = 163245617943825 Try Dim number1 As Long = CLng(ulNumber) Console.WriteLine(number1) Catch e As OverflowException Console.WriteLine("{0} is out of range of an Int64.", ulNumber) End Try Dim dbl2 As Double = 35901.997 Try Dim number2 As Long = CLng(dbl2) Console.WriteLine(number2) Catch e As OverflowException Console.WriteLine("{0} is out of range of an Int64.", dbl2) End Try Dim bigNumber As BigInteger = 1.63201978555e30 Try Dim number3 As Long = CLng(bigNumber) Console.WriteLine(number3) Catch e As OverflowException Console.WriteLine("{0:N0} is out of range of an Int64.", bigNumber) End Try ' The example displays the following output: ' 163245617943825 ' 35902 ' 1,632,019,785,549,999,969,612,091,883,520 is out of range of an Int64.È possibile chiamare un metodo della Convert classe per convertire qualsiasi tipo supportato in un Int64 valore. Ciò è possibile perché Int64 supporta l'interfaccia IConvertible . Nell'esempio seguente viene illustrata la conversione di una matrice di Decimal valori in Int64 valori.
decimal[] values= { Decimal.MinValue, -1034.23m, -12m, 0m, 147m, 199.55m, 9214.16m, Decimal.MaxValue }; long result; foreach (decimal value in values) { try { result = Convert.ToInt64(value); Console.WriteLine("Converted the {0} value '{1}' to the {2} value {3}.", value.GetType().Name, value, result.GetType().Name, result); } catch (OverflowException) { Console.WriteLine("{0} is outside the range of the Int64 type.", value); } } // The example displays the following output: // -79228162514264337593543950335 is outside the range of the Int64 type. // Converted the Decimal value '-1034.23' to the Int64 value -1034. // Converted the Decimal value '-12' to the Int64 value -12. // Converted the Decimal value '0' to the Int64 value 0. // Converted the Decimal value '147' to the Int64 value 147. // Converted the Decimal value '199.55' to the Int64 value 200. // Converted the Decimal value '9214.16' to the Int64 value 9214. // 79228162514264337593543950335 is outside the range of the Int64 type.let values = [| Decimal.MinValue; -1034.23m; -12m; 0m; 147m 199.55m; 9214.16m; Decimal.MaxValue |] for value in values do try let result = Convert.ToInt64 value printfn $"Converted the {value.GetType().Name} value '{value}' to the {result.GetType().Name} value {result}." with :? OverflowException -> printfn $"{value} is outside the range of the Int64 type." // The example displays the following output: // -79228162514264337593543950335 is outside the range of the Int64 type. // Converted the Decimal value '-1034.23' to the Int64 value -1034. // Converted the Decimal value '-12' to the Int64 value -12. // Converted the Decimal value '0' to the Int64 value 0. // Converted the Decimal value '147' to the Int64 value 147. // Converted the Decimal value '199.55' to the Int64 value 200. // Converted the Decimal value '9214.16' to the Int64 value 9214. // 79228162514264337593543950335 is outside the range of the Int64 type.Dim values() As Decimal = { Decimal.MinValue, -1034.23d, -12d, 0d, 147d, _ 199.55d, 9214.16d, Decimal.MaxValue } Dim result As Long For Each value As Decimal In values Try result = Convert.ToInt64(value) Console.WriteLine("Converted the {0} value '{1}' to the {2} value {3}.", _ value.GetType().Name, value, _ result.GetType().Name, result) Catch e As OverflowException Console.WriteLine("{0} is outside the range of the Int64 type.", _ value) End Try Next ' The example displays the following output: ' -79228162514264337593543950335 is outside the range of the Int64 type. ' Converted the Decimal value '-1034.23' to the Int64 value -1034. ' Converted the Decimal value '-12' to the Int64 value -12. ' Converted the Decimal value '0' to the Int64 value 0. ' Converted the Decimal value '147' to the Int64 value 147. ' Converted the Decimal value '199.55' to the Int64 value 200. ' Converted the Decimal value '9214.16' to the Int64 value 9214. ' 79228162514264337593543950335 is outside the range of the Int64 type.È possibile chiamare il metodo Parse o il metodo TryParse per convertire la rappresentazione in stringa di un valore Int64 in un Int64. La stringa può contenere cifre decimali o esadecimali. Nell'esempio seguente viene illustrata l'operazione di analisi usando sia una stringa decimale che una stringa esadecimale.
string string1 = "244681903147"; try { long number1 = Int64.Parse(string1); Console.WriteLine(number1); } catch (OverflowException) { Console.WriteLine($"'{string1}' is out of range of a 64-bit integer."); } catch (FormatException) { Console.WriteLine($"The format of '{string1}' is invalid."); } string string2 = "F9A3CFF0A"; try { long number2 = Int64.Parse(string2, System.Globalization.NumberStyles.HexNumber); Console.WriteLine(number2); } catch (OverflowException) { Console.WriteLine($"'{string2}' is out of range of a 64-bit integer."); } catch (FormatException) { Console.WriteLine($"The format of '{string2}' is invalid."); } // The example displays the following output: // 244681903147 // 67012198154let string1 = "244681903147" try let number1 = Int64.Parse string1 printfn $"{number1}" with | :? OverflowException -> printfn $"'{string1}' is out of range of a 64-bit integer." | :? FormatException -> printfn $"The format of '{string1}' is invalid." let string2 = "F9A3CFF0A" try let number2 = Int64.Parse(string2, NumberStyles.HexNumber) printfn $"{number2}" with | :? OverflowException -> printfn $"'{string2}' is out of range of a 64-bit integer." | :? FormatException -> printfn $"The format of '{string2}' is invalid." // The example displays the following output: // 244681903147 // 67012198154Dim string1 As String = "244681903147" Try Dim number1 As Long = Int64.Parse(string1) Console.WriteLine(number1) Catch e As OverflowException Console.WriteLine("'{0}' is out of range of a 64-bit integer.", string1) Catch e As FormatException Console.WriteLine("The format of '{0}' is invalid.", string1) End Try Dim string2 As String = "F9A3CFF0A" Try Dim number2 As Long = Int64.Parse(string2, System.Globalization.NumberStyles.HexNumber) Console.WriteLine(number2) Catch e As OverflowException Console.WriteLine("'{0}' is out of range of a 64-bit integer.", string2) Catch e As FormatException Console.WriteLine("The format of '{0}' is invalid.", string2) End Try ' The example displays the following output: ' 244681903147 ' 67012198154
Eseguire operazioni sui valori Int64
Il Int64 tipo supporta operazioni matematiche standard, ad esempio addizione, sottrazione, divisione, moltiplicazione, negazione e negazione unaria. Analogamente agli altri tipi integrali, il tipo Int64 supporta anche gli operatori bitwise AND, OR, XOR, spostamento a sinistra e spostamento a destra.
È possibile usare gli operatori numerici standard per confrontare due Int64 valori oppure chiamare il CompareTo metodo o Equals .
È anche possibile chiamare i membri della Math classe per eseguire un'ampia gamma di operazioni numeriche, tra cui ottenere il valore assoluto di un numero, calcolare il quoziente e il resto dalla divisione integrale, determinare il valore massimo o minimo di due interi lunghi, ottenere il segno di un numero e arrotondare un numero.
Rappresentare un oggetto Int64 come stringa
Il Int64 tipo fornisce il supporto completo per le stringhe di formato numerico standard e personalizzato. Per altre informazioni, vedere Formattazione di tipi, stringhe di formato numerico standard e stringhe di formato numerico personalizzato.
Per formattare un Int64 valore come stringa integrale senza zeri iniziali, è possibile chiamare il metodo senza ToString() parametri. Usando l'identificatore di formato "D", è anche possibile includere un numero specificato di zeri iniziali nella rappresentazione di stringa. Usando l'identificatore di formato "N", è possibile includere separatori di gruppo e specificare il numero di cifre decimali da visualizzare nella rappresentazione di stringa del numero. Usando l'identificatore di formato "X", è possibile rappresentare un Int64 valore come stringa esadecimale. L'esempio seguente formatta gli elementi in una matrice di Int64 valori in questi quattro modi.
long[] numbers = { -1403, 0, 169, 1483104 };
foreach (var number in numbers)
{
// Display value using default formatting.
Console.Write("{0,-8} --> ", number.ToString());
// Display value with 3 digits and leading zeros.
Console.Write("{0,8:D3}", number);
// Display value with 1 decimal digit.
Console.Write("{0,13:N1}", number);
// Display value as hexadecimal.
Console.Write("{0,18:X2}", number);
// Display value with eight hexadecimal digits.
Console.WriteLine("{0,18:X8}", number);
}
// The example displays the following output:
// -1403 --> -1403 -1,403.0 FFFFFFFFFFFFFA85 FFFFFFFFFFFFFA85
// 0 --> 000 0.0 00 00000000
// 169 --> 169 169.0 A9 000000A9
// 1483104 --> 1483104 1,483,104.0 16A160 0016A160
let numbers = [| -1403L; 0L; 169L; 1483104L |]
for number in numbers do
// Display value using default formatting.
printf $"{number.ToString(),-8} --> "
// Display value with 3 digits and leading zeros.
printf $"{number,8:D3}"
// Display value with 1 decimal digit.
printf $"{number,13:N1}"
// Display value as hexadecimal.
printf $"{number,18:X2}"
// Display value with eight hexadecimal digits.
printfn $"{number,18:X8}"
// The example displays the following output:
// -1403 --> -1403 -1,403.0 FFFFFFFFFFFFFA85 FFFFFFFFFFFFFA85
// 0 --> 000 0.0 00 00000000
// 169 --> 169 169.0 A9 000000A9
// 1483104 --> 1483104 1,483,104.0 16A160 0016A160
Dim numbers() As Long = { -1403, 0, 169, 1483104 }
For Each number In numbers
' Display value using default formatting.
Console.Write("{0,-8} --> ", number.ToString())
' Display value with 3 digits and leading zeros.
Console.Write("{0,8:D3}", number)
' Display value with 1 decimal digit.
Console.Write("{0,13:N1}", number)
' Display value as hexadecimal.
Console.Write("{0,18:X2}", number)
' Display value with eight hexadecimal digits.
Console.WriteLine("{0,18:X8}", number)
Next
' The example displays the following output:
' -1403 --> -1403 -1,403.0 FFFFFFFFFFFFFA85 FFFFFFFFFFFFFA85
' 0 --> 000 0.0 00 00000000
' 169 --> 169 169.0 A9 000000A9
' 1483104 --> 1483104 1,483,104.0 16A160 0016A160
È anche possibile formattare un Int64 valore come stringa binaria, ottale, decimale o esadecimale chiamando il ToString(Int64, Int32) metodo e specificando la base come secondo parametro del metodo. Nell'esempio seguente viene chiamato questo metodo per visualizzare le rappresentazioni binarie, ottali ed esadecimali di una matrice di valori integer.
long[] numbers = { -146, 11043, 2781913 };
foreach (var number in numbers)
{
Console.WriteLine($"{number} (Base 10):");
Console.WriteLine($" Binary: {Convert.ToString(number, 2)}");
Console.WriteLine($" Octal: {Convert.ToString(number, 8)}");
Console.WriteLine($" Hex: {Convert.ToString(number, 16)}{Environment.NewLine}");
}
// The example displays the following output:
// -146 (Base 10):
// Binary: 1111111111111111111111111111111111111111111111111111111101101110
// Octal: 1777777777777777777556
// Hex: ffffffffffffff6e
//
// 11043 (Base 10):
// Binary: 10101100100011
// Octal: 25443
// Hex: 2b23
//
// 2781913 (Base 10):
// Binary: 1010100111001011011001
// Octal: 12471331
// Hex: 2a72d9
let numbers = [| -146L; 11043L; 2781913L |]
for number in numbers do
printfn $"{number} (Base 10):"
printfn $" Binary: {Convert.ToString(number, 2)}"
printfn $" Octal: {Convert.ToString(number, 8)}"
printfn $" Hex: {Convert.ToString(number, 16)}\n"
// The example displays the following output:
// -146 (Base 10):
// Binary: 1111111111111111111111111111111111111111111111111111111101101110
// Octal: 1777777777777777777556
// Hex: ffffffffffffff6e
//
// 11043 (Base 10):
// Binary: 10101100100011
// Octal: 25443
// Hex: 2b23
//
// 2781913 (Base 10):
// Binary: 1010100111001011011001
// Octal: 12471331
// Hex: 2a72d9
Dim numbers() As Long = { -146, 11043, 2781913 }
For Each number In numbers
Console.WriteLine("{0} (Base 10):", number)
Console.WriteLine(" Binary: {0}", Convert.ToString(number, 2))
Console.WriteLine(" Octal: {0}", Convert.ToString(number, 8))
Console.WriteLine(" Hex: {0}", Convert.ToString(number, 16))
Console.WriteLine()
Next
' The example displays the following output:
' -146 (Base 10):
' Binary: 1111111111111111111111111111111111111111111111111111111101101110
' Octal: 1777777777777777777556
' Hex: ffffffffffffff6e
'
' 11043 (Base 10):
' Binary: 10101100100011
' Octal: 25443
' Hex: 2b23
'
' 2781913 (Base 10):
' Binary: 1010100111001011011001
' Octal: 12471331
' Hex: 2a72d9
Usare valori interi non decimali a 64 bit
Oltre a usare singoli numeri interi lunghi come valori decimali, è possibile eseguire operazioni bit per bit o usare le rappresentazioni binarie o esadecimali di valori integer lunghi. Int64 i valori sono rappresentati in 63 bit, con il sessantaquattr bit usato come bit di segno. I valori positivi sono rappresentati usando la rappresentazione di segno e grandezza. I valori negativi sono nella rappresentazione di complemento di due. Questo aspetto è importante da tenere presente quando si eseguono operazioni bit per bit sui Int64 valori o quando si lavora con singoli bit. Per eseguire un'operazione numerica, booleana o di confronto su due valori non decimali, entrambi i valori devono usare la stessa rappresentazione.
Campi
| Nome | Descrizione |
|---|---|
| MaxValue |
Rappresenta il valore massimo possibile di un oggetto Int64. Questo campo è costante. |
| MinValue |
Rappresenta il valore più piccolo possibile di un oggetto Int64. Questo campo è costante. |
Metodi
| Nome | Descrizione |
|---|---|
| Abs(Int64) |
Calcola l'assoluto di un valore. |
| BigMul(Int64, Int64) |
Produce il prodotto completo di due numeri a 64 bit. |
| Clamp(Int64, Int64, Int64) |
Blocca un valore a un valore minimo e massimo inclusivo. |
| CompareTo(Int64) |
Confronta questa istanza con un intero con segno a 64 bit specificato e restituisce un'indicazione dei relativi valori. |
| CompareTo(Object) |
Confronta questa istanza con un oggetto specificato e restituisce un'indicazione dei relativi valori. |
| CopySign(Int64, Int64) |
Copia il segno di un valore nel segno di un altro valore. |
| CreateChecked<TOther>(TOther) |
Crea un'istanza del tipo corrente da un valore, generando un'eccezione di overflow per tutti i valori che non rientrano nell'intervallo rappresentabile del tipo corrente. |
| CreateSaturating<TOther>(TOther) |
Crea un'istanza del tipo corrente da un valore, saturando tutti i valori che non rientrano nell'intervallo rappresentabile del tipo corrente. |
| CreateTruncating<TOther>(TOther) |
Crea un'istanza del tipo corrente da un valore, troncando tutti i valori che non rientrano nell'intervallo rappresentabile del tipo corrente. |
| DivRem(Int64, Int64) |
Calcola il quoziente e il resto di due valori. |
| Equals(Int64) |
Restituisce un valore che indica se questa istanza è uguale a un valore specificato Int64 . |
| Equals(Object) |
Restituisce un valore che indica se questa istanza è uguale a un oggetto specificato. |
| GetHashCode() |
Restituisce il codice hash per questa istanza. |
| GetTypeCode() | |
| IsEvenInteger(Int64) |
Determina se un valore rappresenta un numero integrale pari. |
| IsNegative(Int64) |
Determina se un valore è negativo. |
| IsOddInteger(Int64) |
Determina se un valore rappresenta un numero integrale dispari. |
| IsPositive(Int64) |
Determina se un valore è positivo. |
| IsPow2(Int64) |
Determina se un valore è una potenza di due. |
| LeadingZeroCount(Int64) |
Calcola il numero di zeri iniziali in un valore. |
| Log10(Int64) |
Rappresenta un intero con segno a 64 bit. |
| Log2(Int64) |
Calcola il log2 di un valore. |
| Max(Int64, Int64) |
Confronta due valori con il calcolo maggiore. |
| MaxMagnitude(Int64, Int64) |
Confronta due valori con il calcolo maggiore. |
| Min(Int64, Int64) |
Confronta due valori con il calcolo minore. |
| MinMagnitude(Int64, Int64) |
Confronta due valori con il calcolo minore. |
| Parse(ReadOnlySpan<Byte>, IFormatProvider) |
Analizza un intervallo di caratteri UTF-8 in un valore. |
| Parse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider) |
Analizza un intervallo di caratteri UTF-8 in un valore. |
| Parse(ReadOnlySpan<Char>, IFormatProvider) |
Analizza un intervallo di caratteri in un valore. |
| Parse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider) |
Converte la rappresentazione dell'intervallo di un numero in uno stile e in un formato specifico delle impostazioni cultura specificati nell'equivalente intero con segno a 64 bit. |
| Parse(String, IFormatProvider) |
Converte la rappresentazione di stringa di un numero in un formato specifico delle impostazioni cultura specificato nell'equivalente intero con segno a 64 bit. |
| Parse(String, NumberStyles, IFormatProvider) |
Converte la rappresentazione di stringa di un numero in uno stile specificato e in un formato specifico delle impostazioni cultura nell'equivalente intero con segno a 64 bit. |
| Parse(String, NumberStyles) |
Converte la rappresentazione di stringa di un numero in uno stile specificato nell'equivalente intero con segno a 64 bit. |
| Parse(String) |
Converte la rappresentazione di stringa di un numero nell'equivalente intero con segno a 64 bit. |
| PopCount(Int64) |
Calcola il numero di bit impostati in un valore. |
| RotateLeft(Int64, Int32) |
Ruota un valore a sinistra di una determinata quantità. |
| RotateRight(Int64, Int32) |
Ruota un valore a destra di una determinata quantità. |
| Sign(Int64) |
Calcola il segno di un valore. |
| ToString() |
Converte il valore numerico di questa istanza nella rappresentazione di stringa equivalente. |
| ToString(IFormatProvider) |
Converte il valore numerico di questa istanza nella rappresentazione di stringa equivalente usando le informazioni sul formato specifiche delle impostazioni cultura specificate. |
| ToString(String, IFormatProvider) |
Converte il valore numerico di questa istanza nella rappresentazione di stringa equivalente utilizzando il formato specificato e le informazioni sul formato specifiche delle impostazioni cultura. |
| ToString(String) |
Converte il valore numerico di questa istanza nella rappresentazione di stringa equivalente utilizzando il formato specificato. |
| TrailingZeroCount(Int64) |
Calcola il numero di zeri finali in un valore. |
| TryFormat(Span<Byte>, Int32, ReadOnlySpan<Char>, IFormatProvider) |
Prova a formattare il valore dell'istanza corrente come UTF-8 nell'intervallo di byte specificato. |
| TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider) |
Prova a formattare il valore dell'istanza del numero lungo corrente nell'intervallo di caratteri specificato. |
| TryParse(ReadOnlySpan<Byte>, IFormatProvider, Int64) |
Prova ad analizzare un intervallo di caratteri UTF-8 in un valore. |
| TryParse(ReadOnlySpan<Byte>, Int64) |
Tenta di convertire un intervallo di caratteri UTF-8 contenente la rappresentazione di stringa di un numero nell'equivalente intero con segno a 64 bit. |
| TryParse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider, Int64) |
Prova ad analizzare un intervallo di caratteri UTF-8 in un valore. |
| TryParse(ReadOnlySpan<Char>, IFormatProvider, Int64) |
Tenta di analizzare un intervallo di caratteri in un valore. |
| TryParse(ReadOnlySpan<Char>, Int64) |
Converte la rappresentazione dell'intervallo di un numero nell'equivalente intero con segno a 64 bit. Un valore restituito indica se la conversione ha avuto esito positivo o negativo. |
| TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, Int64) |
Converte la rappresentazione dell'intervallo di un numero in uno stile e in un formato specifico delle impostazioni cultura specificati nell'equivalente intero con segno a 64 bit. Un valore restituito indica se la conversione ha avuto esito positivo o negativo. |
| TryParse(String, IFormatProvider, Int64) |
Tenta di analizzare una stringa in un valore. |
| TryParse(String, Int64) |
Converte la rappresentazione di stringa di un numero nell'equivalente intero con segno a 64 bit. Un valore restituito indica se la conversione ha avuto esito positivo o negativo. |
| TryParse(String, NumberStyles, IFormatProvider, Int64) |
Converte la rappresentazione di stringa di un numero in uno stile specificato e in un formato specifico delle impostazioni cultura nell'equivalente intero con segno a 64 bit. Un valore restituito indica se la conversione ha avuto esito positivo o negativo. |
Implementazioni dell'interfaccia esplicita
| Nome | Descrizione |
|---|---|
| IAdditionOperators<Int64,Int64,Int64>.Addition(Int64, Int64) |
Aggiunge due valori insieme per calcolare la somma. |
| IAdditionOperators<Int64,Int64,Int64>.CheckedAddition(Int64, Int64) |
Aggiunge due valori insieme per calcolare la somma. |
| IAdditiveIdentity<Int64,Int64>.AdditiveIdentity |
Ottiene l'identità aggiuntiva del tipo corrente. |
| IBinaryInteger<Int64>.GetByteCount() |
Ottiene il numero di byte che verranno scritti come parte di TryWriteLittleEndian(Span<Byte>, Int32). |
| IBinaryInteger<Int64>.GetShortestBitLength() |
Ottiene la lunghezza, espressa in bit, della rappresentazione complementare più breve del valore corrente. |
| IBinaryInteger<Int64>.TryReadBigEndian(ReadOnlySpan<Byte>, Boolean, Int64) |
Rappresenta un intero con segno a 64 bit. |
| IBinaryInteger<Int64>.TryReadLittleEndian(ReadOnlySpan<Byte>, Boolean, Int64) |
Rappresenta un intero con segno a 64 bit. |
| IBinaryInteger<Int64>.TryWriteBigEndian(Span<Byte>, Int32) |
Prova a scrivere il valore corrente, in formato big-endian, in un intervallo specificato. |
| IBinaryInteger<Int64>.TryWriteLittleEndian(Span<Byte>, Int32) |
Prova a scrivere il valore corrente, in formato little-endian, in un intervallo specificato. |
| IBinaryNumber<Int64>.AllBitsSet |
Ottiene un'istanza del tipo binario in cui vengono impostati tutti i bit. |
| IBitwiseOperators<Int64,Int64,Int64>.BitwiseAnd(Int64, Int64) |
Calcola i valori bit per bit e di due valori. |
| IBitwiseOperators<Int64,Int64,Int64>.BitwiseOr(Int64, Int64) |
Calcola i valori bit per bit o di due valori. |
| IBitwiseOperators<Int64,Int64,Int64>.ExclusiveOr(Int64, Int64) |
Calcola il valore esclusivo o di due valori. |
| IBitwiseOperators<Int64,Int64,Int64>.OnesComplement(Int64) |
Calcola la rappresentazione di complemento di un determinato valore. |
| IComparable.CompareTo(Object) |
Confronta questa istanza con un oggetto specificato e restituisce un'indicazione dei relativi valori. |
| IComparisonOperators<Int64,Int64,Boolean>.GreaterThan(Int64, Int64) |
Confronta due valori per determinare quale è maggiore. |
| IComparisonOperators<Int64,Int64,Boolean>.GreaterThanOrEqual(Int64, Int64) |
Confronta due valori per determinare quale è maggiore o uguale. |
| IComparisonOperators<Int64,Int64,Boolean>.LessThan(Int64, Int64) |
Confronta due valori per determinare quale è minore. |
| IComparisonOperators<Int64,Int64,Boolean>.LessThanOrEqual(Int64, Int64) |
Confronta due valori per determinare quale è minore o uguale. |
| IConvertible.GetTypeCode() | |
| IConvertible.ToBoolean(IFormatProvider) |
Per una descrizione di questo membro, vedere ToBoolean(IFormatProvider). |
| IConvertible.ToByte(IFormatProvider) |
Per una descrizione di questo membro, vedere ToByte(IFormatProvider). |
| IConvertible.ToChar(IFormatProvider) |
Per una descrizione di questo membro, vedere ToChar(IFormatProvider). |
| IConvertible.ToDateTime(IFormatProvider) |
Questa conversione non è supportata. Il tentativo di utilizzare questo metodo genera un'eccezione InvalidCastException. |
| IConvertible.ToDecimal(IFormatProvider) |
Per una descrizione di questo membro, vedere ToDecimal(IFormatProvider). |
| IConvertible.ToDouble(IFormatProvider) |
Per una descrizione di questo membro, vedere ToDouble(IFormatProvider). |
| IConvertible.ToInt16(IFormatProvider) |
Per una descrizione di questo membro, vedere ToInt16(IFormatProvider). |
| IConvertible.ToInt32(IFormatProvider) |
Per una descrizione di questo membro, vedere ToInt32(IFormatProvider). |
| IConvertible.ToInt64(IFormatProvider) |
Per una descrizione di questo membro, vedere ToInt64(IFormatProvider). |
| IConvertible.ToSByte(IFormatProvider) |
Per una descrizione di questo membro, vedere ToSByte(IFormatProvider). |
| IConvertible.ToSingle(IFormatProvider) |
Per una descrizione di questo membro, vedere ToSingle(IFormatProvider). |
| IConvertible.ToType(Type, IFormatProvider) |
Per una descrizione di questo membro, vedere ToType(Type, IFormatProvider). |
| IConvertible.ToUInt16(IFormatProvider) |
Per una descrizione di questo membro, vedere ToUInt16(IFormatProvider). |
| IConvertible.ToUInt32(IFormatProvider) |
Per una descrizione di questo membro, vedere ToUInt32(IFormatProvider). |
| IConvertible.ToUInt64(IFormatProvider) |
Per una descrizione di questo membro, vedere ToUInt64(IFormatProvider). |
| IDecrementOperators<Int64>.CheckedDecrement(Int64) |
Decrementa un valore. |
| IDecrementOperators<Int64>.Decrement(Int64) |
Decrementa un valore. |
| IDivisionOperators<Int64,Int64,Int64>.Division(Int64, Int64) |
Divide un valore per un altro per calcolare il quoziente. |
| IEqualityOperators<Int64,Int64,Boolean>.Equality(Int64, Int64) |
Confronta due valori per determinare l'uguaglianza. |
| IEqualityOperators<Int64,Int64,Boolean>.Inequality(Int64, Int64) |
Confronta due valori per determinare la disuguaglianza. |
| IIncrementOperators<Int64>.CheckedIncrement(Int64) |
Incrementa un valore. |
| IIncrementOperators<Int64>.Increment(Int64) |
Incrementa un valore. |
| IMinMaxValue<Int64>.MaxValue |
Ottiene il valore massimo del tipo corrente. |
| IMinMaxValue<Int64>.MinValue |
Ottiene il valore minimo del tipo corrente. |
| IModulusOperators<Int64,Int64,Int64>.Modulus(Int64, Int64) |
Divide due valori insieme per calcolare il modulo o il resto. |
| IMultiplicativeIdentity<Int64,Int64>.MultiplicativeIdentity |
Ottiene l'identità moltiplicativa del tipo corrente. |
| IMultiplyOperators<Int64,Int64,Int64>.CheckedMultiply(Int64, Int64) |
Moltiplica due valori insieme per calcolare il prodotto. |
| IMultiplyOperators<Int64,Int64,Int64>.Multiply(Int64, Int64) |
Moltiplica due valori insieme per calcolare il prodotto. |
| INumber<Int64>.MaxNumber(Int64, Int64) |
Confronta due valori con il calcolo maggiore e restituendo l'altro valore se un input è |
| INumber<Int64>.MinNumber(Int64, Int64) |
Confronta due valori con il calcolo minore e restituendo l'altro valore se un input è |
| INumberBase<Int64>.IsCanonical(Int64) |
Determina se un valore è nella relativa rappresentazione canonica. |
| INumberBase<Int64>.IsComplexNumber(Int64) |
Determina se un valore rappresenta un numero complesso. |
| INumberBase<Int64>.IsFinite(Int64) |
Determina se un valore è finito. |
| INumberBase<Int64>.IsImaginaryNumber(Int64) |
Determina se un valore rappresenta un numero immaginario puro. |
| INumberBase<Int64>.IsInfinity(Int64) |
Determina se un valore è infinito. |
| INumberBase<Int64>.IsInteger(Int64) |
Determina se un valore rappresenta un numero integrale. |
| INumberBase<Int64>.IsNaN(Int64) |
Determina se un valore è NaN. |
| INumberBase<Int64>.IsNegativeInfinity(Int64) |
Determina se un valore è infinito negativo. |
| INumberBase<Int64>.IsNormal(Int64) |
Determina se un valore è normale. |
| INumberBase<Int64>.IsPositiveInfinity(Int64) |
Determina se un valore è infinito positivo. |
| INumberBase<Int64>.IsRealNumber(Int64) |
Determina se un valore rappresenta un numero reale. |
| INumberBase<Int64>.IsSubnormal(Int64) |
Determina se un valore è sottonormamale. |
| INumberBase<Int64>.IsZero(Int64) |
Determina se un valore è zero. |
| INumberBase<Int64>.MaxMagnitudeNumber(Int64, Int64) |
Confronta due valori con il calcolo con la grandezza maggiore e restituendo l'altro valore se un input è |
| INumberBase<Int64>.MinMagnitudeNumber(Int64, Int64) |
Confronta due valori con il calcolo con la grandezza minore e restituendo l'altro valore se un input è |
| INumberBase<Int64>.MultiplyAddEstimate(Int64, Int64, Int64) |
Calcola una stima di ( |
| INumberBase<Int64>.One |
Ottiene il valore |
| INumberBase<Int64>.Radix |
Ottiene la radice o la base del tipo. |
| INumberBase<Int64>.TryConvertFromChecked<TOther>(TOther, Int64) |
Rappresenta un intero con segno a 64 bit. |
| INumberBase<Int64>.TryConvertFromSaturating<TOther>(TOther, Int64) |
Rappresenta un intero con segno a 64 bit. |
| INumberBase<Int64>.TryConvertFromTruncating<TOther>(TOther, Int64) |
Rappresenta un intero con segno a 64 bit. |
| INumberBase<Int64>.TryConvertToChecked<TOther>(Int64, TOther) |
Tenta di convertire un'istanza del tipo corrente in un altro tipo, generando un'eccezione di overflow per tutti i valori che non rientrano nell'intervallo rappresentabile del tipo corrente. |
| INumberBase<Int64>.TryConvertToSaturating<TOther>(Int64, TOther) |
Tenta di convertire un'istanza del tipo corrente in un altro tipo, saturando tutti i valori che non rientrano nell'intervallo rappresentabile del tipo corrente. |
| INumberBase<Int64>.TryConvertToTruncating<TOther>(Int64, TOther) |
Tenta di convertire un'istanza del tipo corrente in un altro tipo, troncando tutti i valori che non rientrano nell'intervallo rappresentabile del tipo corrente. |
| INumberBase<Int64>.Zero |
Ottiene il valore |
| IShiftOperators<Int64,Int32,Int64>.LeftShift(Int64, Int32) |
Sposta un valore a sinistra di una determinata quantità. |
| IShiftOperators<Int64,Int32,Int64>.RightShift(Int64, Int32) |
Sposta un valore a destra di una determinata quantità. |
| IShiftOperators<Int64,Int32,Int64>.UnsignedRightShift(Int64, Int32) |
Sposta un valore a destra di una determinata quantità. |
| ISignedNumber<Int64>.NegativeOne |
Ottiene il valore |
| ISubtractionOperators<Int64,Int64,Int64>.CheckedSubtraction(Int64, Int64) |
Sottrae due valori per calcolare la differenza. |
| ISubtractionOperators<Int64,Int64,Int64>.Subtraction(Int64, Int64) |
Sottrae due valori per calcolare la differenza. |
| IUnaryNegationOperators<Int64,Int64>.CheckedUnaryNegation(Int64) |
Calcola la negazione unaria controllata di un valore. |
| IUnaryNegationOperators<Int64,Int64>.UnaryNegation(Int64) |
Calcola la negazione unaria di un valore. |
| IUnaryPlusOperators<Int64,Int64>.UnaryPlus(Int64) |
Calcola il plus unario di un valore. |
Si applica a
Thread safety
Tutti i membri di questo tipo sono thread-safe. I membri che sembrano modificare lo stato dell'istanza restituiscono effettivamente una nuova istanza inizializzata con il nuovo valore. Come per qualsiasi altro tipo, la lettura e la scrittura in una variabile condivisa contenente un'istanza di questo tipo devono essere protette da un blocco per garantire la thread safety.