Int32 Structure

Définition

Représente un entier signé 32 bits.

public value class int : IComparable, IComparable<int>, IConvertible, IEquatable<int>, IFormattable
public value class int : IComparable<int>, IConvertible, IEquatable<int>, IParsable<int>, ISpanParsable<int>, IUtf8SpanParsable<int>, System::Numerics::IAdditionOperators<int, int, int>, System::Numerics::IAdditiveIdentity<int, int>, System::Numerics::IBinaryInteger<int>, System::Numerics::IBinaryNumber<int>, System::Numerics::IBitwiseOperators<int, int, int>, System::Numerics::IComparisonOperators<int, int, bool>, System::Numerics::IDecrementOperators<int>, System::Numerics::IDivisionOperators<int, int, int>, System::Numerics::IEqualityOperators<int, int, bool>, System::Numerics::IIncrementOperators<int>, System::Numerics::IMinMaxValue<int>, System::Numerics::IModulusOperators<int, int, int>, System::Numerics::IMultiplicativeIdentity<int, int>, System::Numerics::IMultiplyOperators<int, int, int>, System::Numerics::INumber<int>, System::Numerics::INumberBase<int>, System::Numerics::IShiftOperators<int, int, int>, System::Numerics::ISignedNumber<int>, System::Numerics::ISubtractionOperators<int, int, int>, System::Numerics::IUnaryNegationOperators<int, int>, System::Numerics::IUnaryPlusOperators<int, int>
public value class int : IComparable, IComparable<int>, IConvertible, IEquatable<int>, ISpanFormattable
public value class int : IComparable<int>, IConvertible, IEquatable<int>, IParsable<int>, ISpanParsable<int>, System::Numerics::IAdditionOperators<int, int, int>, System::Numerics::IAdditiveIdentity<int, int>, System::Numerics::IBinaryInteger<int>, System::Numerics::IBinaryNumber<int>, System::Numerics::IBitwiseOperators<int, int, int>, System::Numerics::IComparisonOperators<int, int, bool>, System::Numerics::IDecrementOperators<int>, System::Numerics::IDivisionOperators<int, int, int>, System::Numerics::IEqualityOperators<int, int, bool>, System::Numerics::IIncrementOperators<int>, System::Numerics::IMinMaxValue<int>, System::Numerics::IModulusOperators<int, int, int>, System::Numerics::IMultiplicativeIdentity<int, int>, System::Numerics::IMultiplyOperators<int, int, int>, System::Numerics::INumber<int>, System::Numerics::INumberBase<int>, System::Numerics::IShiftOperators<int, int, int>, System::Numerics::ISignedNumber<int>, System::Numerics::ISubtractionOperators<int, int, int>, System::Numerics::IUnaryNegationOperators<int, int>, System::Numerics::IUnaryPlusOperators<int, int>
public value class int : IComparable, IConvertible, IFormattable
public value class int : IComparable, IComparable<int>, IEquatable<int>, IFormattable
public struct Int32 : IComparable, IComparable<int>, IConvertible, IEquatable<int>, IFormattable
public readonly struct Int32 : IComparable<int>, IConvertible, IEquatable<int>, IParsable<int>, ISpanParsable<int>, IUtf8SpanParsable<int>, System.Numerics.IAdditionOperators<int,int,int>, System.Numerics.IAdditiveIdentity<int,int>, System.Numerics.IBinaryInteger<int>, System.Numerics.IBinaryNumber<int>, System.Numerics.IBitwiseOperators<int,int,int>, System.Numerics.IComparisonOperators<int,int,bool>, System.Numerics.IDecrementOperators<int>, System.Numerics.IDivisionOperators<int,int,int>, System.Numerics.IEqualityOperators<int,int,bool>, System.Numerics.IIncrementOperators<int>, System.Numerics.IMinMaxValue<int>, System.Numerics.IModulusOperators<int,int,int>, System.Numerics.IMultiplicativeIdentity<int,int>, System.Numerics.IMultiplyOperators<int,int,int>, System.Numerics.INumber<int>, System.Numerics.INumberBase<int>, System.Numerics.IShiftOperators<int,int,int>, System.Numerics.ISignedNumber<int>, System.Numerics.ISubtractionOperators<int,int,int>, System.Numerics.IUnaryNegationOperators<int,int>, System.Numerics.IUnaryPlusOperators<int,int>
public readonly struct Int32 : IComparable, IComparable<int>, IConvertible, IEquatable<int>, IFormattable
public readonly struct Int32 : IComparable, IComparable<int>, IConvertible, IEquatable<int>, ISpanFormattable
public readonly struct Int32 : IComparable<int>, IConvertible, IEquatable<int>, IParsable<int>, ISpanParsable<int>, System.Numerics.IAdditionOperators<int,int,int>, System.Numerics.IAdditiveIdentity<int,int>, System.Numerics.IBinaryInteger<int>, System.Numerics.IBinaryNumber<int>, System.Numerics.IBitwiseOperators<int,int,int>, System.Numerics.IComparisonOperators<int,int,bool>, System.Numerics.IDecrementOperators<int>, System.Numerics.IDivisionOperators<int,int,int>, System.Numerics.IEqualityOperators<int,int,bool>, System.Numerics.IIncrementOperators<int>, System.Numerics.IMinMaxValue<int>, System.Numerics.IModulusOperators<int,int,int>, System.Numerics.IMultiplicativeIdentity<int,int>, System.Numerics.IMultiplyOperators<int,int,int>, System.Numerics.INumber<int>, System.Numerics.INumberBase<int>, System.Numerics.IShiftOperators<int,int,int>, System.Numerics.ISignedNumber<int>, System.Numerics.ISubtractionOperators<int,int,int>, System.Numerics.IUnaryNegationOperators<int,int>, System.Numerics.IUnaryPlusOperators<int,int>
[System.Serializable]
public struct Int32 : IComparable, IConvertible, IFormattable
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public struct Int32 : IComparable, IComparable<int>, IConvertible, IEquatable<int>, IFormattable
public struct Int32 : IComparable, IComparable<int>, IEquatable<int>, IFormattable
type int = struct
    interface IConvertible
    interface IFormattable
type int = struct
    interface IConvertible
    interface IFormattable
    interface IParsable<int>
    interface ISpanFormattable
    interface ISpanParsable<int>
    interface IUtf8SpanFormattable
    interface IUtf8SpanParsable<int>
    interface IAdditionOperators<int, int, int>
    interface IAdditiveIdentity<int, int>
    interface IBinaryInteger<int>
    interface IBinaryNumber<int>
    interface IBitwiseOperators<int, int, int>
    interface IComparisonOperators<int, int, bool>
    interface IEqualityOperators<int, int, bool>
    interface IDecrementOperators<int>
    interface IDivisionOperators<int, int, int>
    interface IIncrementOperators<int>
    interface IModulusOperators<int, int, int>
    interface IMultiplicativeIdentity<int, int>
    interface IMultiplyOperators<int, int, int>
    interface INumber<int>
    interface INumberBase<int>
    interface ISubtractionOperators<int, int, int>
    interface IUnaryNegationOperators<int, int>
    interface IUnaryPlusOperators<int, int>
    interface IShiftOperators<int, int, int>
    interface IMinMaxValue<int>
    interface ISignedNumber<int>
type int = struct
    interface IConvertible
    interface ISpanFormattable
    interface IFormattable
type int = struct
    interface IConvertible
    interface IFormattable
    interface IParsable<int>
    interface ISpanFormattable
    interface ISpanParsable<int>
    interface IAdditionOperators<int, int, int>
    interface IAdditiveIdentity<int, int>
    interface IBinaryInteger<int>
    interface IBinaryNumber<int>
    interface IBitwiseOperators<int, int, int>
    interface IComparisonOperators<int, int, bool>
    interface IEqualityOperators<int, int, bool>
    interface IDecrementOperators<int>
    interface IDivisionOperators<int, int, int>
    interface IIncrementOperators<int>
    interface IModulusOperators<int, int, int>
    interface IMultiplicativeIdentity<int, int>
    interface IMultiplyOperators<int, int, int>
    interface INumber<int>
    interface INumberBase<int>
    interface ISubtractionOperators<int, int, int>
    interface IUnaryNegationOperators<int, int>
    interface IUnaryPlusOperators<int, int>
    interface IShiftOperators<int, int, int>
    interface IMinMaxValue<int>
    interface ISignedNumber<int>
type int = struct
    interface IConvertible
    interface IFormattable
    interface IParsable<int>
    interface ISpanFormattable
    interface ISpanParsable<int>
    interface IAdditionOperators<int, int, int>
    interface IAdditiveIdentity<int, int>
    interface IBinaryInteger<int>
    interface IBinaryNumber<int>
    interface IBitwiseOperators<int, int, int>
    interface IComparisonOperators<int, int, bool>
    interface IEqualityOperators<int, int, bool>
    interface IDecrementOperators<int>
    interface IDivisionOperators<int, int, int>
    interface IIncrementOperators<int>
    interface IModulusOperators<int, int, int>
    interface IMultiplicativeIdentity<int, int>
    interface IMultiplyOperators<int, int, int>
    interface INumber<int>
    interface INumberBase<int>
    interface ISubtractionOperators<int, int, int>
    interface IUnaryNegationOperators<int, int>
    interface IUnaryPlusOperators<int, int>
    interface IUtf8SpanFormattable
    interface IUtf8SpanParsable<int>
    interface IShiftOperators<int, int, int>
    interface IMinMaxValue<int>
    interface ISignedNumber<int>
[<System.Serializable>]
type int = struct
    interface IFormattable
    interface IConvertible
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type int = struct
    interface IFormattable
    interface IConvertible
type int = struct
    interface IFormattable
Public Structure Int32
Implements IComparable, IComparable(Of Integer), IConvertible, IEquatable(Of Integer), IFormattable
Public Structure Int32
Implements IAdditionOperators(Of Integer, Integer, Integer), IAdditiveIdentity(Of Integer, Integer), IBinaryInteger(Of Integer), IBinaryNumber(Of Integer), IBitwiseOperators(Of Integer, Integer, Integer), IComparable(Of Integer), IComparisonOperators(Of Integer, Integer, Boolean), IConvertible, IDecrementOperators(Of Integer), IDivisionOperators(Of Integer, Integer, Integer), IEqualityOperators(Of Integer, Integer, Boolean), IEquatable(Of Integer), IIncrementOperators(Of Integer), IMinMaxValue(Of Integer), IModulusOperators(Of Integer, Integer, Integer), IMultiplicativeIdentity(Of Integer, Integer), IMultiplyOperators(Of Integer, Integer, Integer), INumber(Of Integer), INumberBase(Of Integer), IParsable(Of Integer), IShiftOperators(Of Integer, Integer, Integer), ISignedNumber(Of Integer), ISpanParsable(Of Integer), ISubtractionOperators(Of Integer, Integer, Integer), IUnaryNegationOperators(Of Integer, Integer), IUnaryPlusOperators(Of Integer, Integer), IUtf8SpanParsable(Of Integer)
Public Structure Int32
Implements IComparable, IComparable(Of Integer), IConvertible, IEquatable(Of Integer), ISpanFormattable
Public Structure Int32
Implements IAdditionOperators(Of Integer, Integer, Integer), IAdditiveIdentity(Of Integer, Integer), IBinaryInteger(Of Integer), IBinaryNumber(Of Integer), IBitwiseOperators(Of Integer, Integer, Integer), IComparable(Of Integer), IComparisonOperators(Of Integer, Integer, Boolean), IConvertible, IDecrementOperators(Of Integer), IDivisionOperators(Of Integer, Integer, Integer), IEqualityOperators(Of Integer, Integer, Boolean), IEquatable(Of Integer), IIncrementOperators(Of Integer), IMinMaxValue(Of Integer), IModulusOperators(Of Integer, Integer, Integer), IMultiplicativeIdentity(Of Integer, Integer), IMultiplyOperators(Of Integer, Integer, Integer), INumber(Of Integer), INumberBase(Of Integer), IParsable(Of Integer), IShiftOperators(Of Integer, Integer, Integer), ISignedNumber(Of Integer), ISpanParsable(Of Integer), ISubtractionOperators(Of Integer, Integer, Integer), IUnaryNegationOperators(Of Integer, Integer), IUnaryPlusOperators(Of Integer, Integer)
Public Structure Int32
Implements IComparable, IConvertible, IFormattable
Public Structure Int32
Implements IComparable, IComparable(Of Integer), IEquatable(Of Integer), IFormattable
Héritage
Attributs
Implémente
IComparable IComparable<Int32> IConvertible IEquatable<Int32> IFormattable IComparable<TSelf> IEquatable<TSelf> IParsable<Int32> IParsable<TSelf> ISpanFormattable ISpanParsable<Int32> ISpanParsable<TSelf> IUtf8SpanFormattable IUtf8SpanParsable<Int32> IUtf8SpanParsable<TSelf> IAdditionOperators<Int32,Int32,Int32> IAdditionOperators<TSelf,TSelf,TSelf> IAdditiveIdentity<Int32,Int32> IAdditiveIdentity<TSelf,TSelf> IBinaryInteger<Int32> IBinaryNumber<Int32> IBinaryNumber<TSelf> IBitwiseOperators<Int32,Int32,Int32> IBitwiseOperators<TSelf,TSelf,TSelf> IComparisonOperators<Int32,Int32,Boolean> IComparisonOperators<TSelf,TSelf,Boolean> IDecrementOperators<Int32> IDecrementOperators<TSelf> IDivisionOperators<Int32,Int32,Int32> IDivisionOperators<TSelf,TSelf,TSelf> IEqualityOperators<Int32,Int32,Boolean> IEqualityOperators<TSelf,TOther,TResult> IEqualityOperators<TSelf,TSelf,Boolean> IIncrementOperators<Int32> IIncrementOperators<TSelf> IMinMaxValue<Int32> IModulusOperators<Int32,Int32,Int32> IModulusOperators<TSelf,TSelf,TSelf> IMultiplicativeIdentity<Int32,Int32> IMultiplicativeIdentity<TSelf,TSelf> IMultiplyOperators<Int32,Int32,Int32> IMultiplyOperators<TSelf,TSelf,TSelf> INumber<Int32> INumber<TSelf> INumberBase<Int32> INumberBase<TSelf> IShiftOperators<Int32,Int32,Int32> IShiftOperators<TSelf,Int32,TSelf> ISignedNumber<Int32> ISubtractionOperators<Int32,Int32,Int32> ISubtractionOperators<TSelf,TSelf,TSelf> IUnaryNegationOperators<Int32,Int32> IUnaryNegationOperators<TSelf,TSelf> IUnaryPlusOperators<Int32,Int32> IUnaryPlusOperators<TSelf,TSelf>

Remarques

Int32 est un type de valeur immuable qui représente des entiers signés avec des valeurs comprises entre -2 147 483 648 (ce qui est représenté par la constante Int32.MinValue) et 2 147 483 647 (ce qui est représenté par la constante Int32.MaxValue). .NET inclut également un type de valeur entière 32 bits non signé, UInt32qui représente des valeurs comprises entre 0 et 4 294 967 295.

Instancier une valeur Int32

Vous pouvez instancier une Int32 valeur de plusieurs façons :

  • Vous pouvez déclarer une Int32 variable et l’affecter à une valeur entière littérale qui se trouve dans la plage du Int32 type de données. L’exemple suivant déclare deux Int32 variables et leur attribue des valeurs de cette façon.

    int number1 = 64301;
    int number2 = 25548612;
    
    let number1 = 64301
    let number2 = 25548612
    
    Dim number1 As Integer = 64301
    Dim number2 As Integer = 25548612
    
  • Vous pouvez affecter la valeur d’un type entier dont la plage est un sous-ensemble du Int32 type. Il s’agit d’une conversion étendue qui ne nécessite pas d’opérateur de cast en C# ou d’une méthode de conversion en Visual Basic, mais qui en nécessite une en F#.

    sbyte value1 = 124;
    short value2 = 1618;
    
    int number1 = value1;
    int number2 = value2;
    
    let value1 = 124y
    let value2 = 1618s
    
    let number1 = int value1
    let number2 = int value2
    
    Dim value1 As SByte = 124
    Dim value2 As Int16 = 1618
    
    Dim number1 As Integer = value1
    Dim number2 As Integer = value2
    
  • Vous pouvez affecter la valeur d’un type numérique dont la plage dépasse celle du Int32 type. Il s'agit d'une conversion étroite, ce qui nécessite un opérateur de cast en C# ou F#, et une méthode de conversion en Visual Basic si Option Strict est activé. Si la valeur numérique est un Single, Doubleou Decimal une valeur qui inclut un composant fractionnaire, la gestion de sa partie fractionnaire dépend du compilateur effectuant la conversion. L’exemple suivant effectue des conversions restrictives pour affecter plusieurs valeurs numériques à des Int32 variables.

    long lNumber = 163245617;
    try {
       int number1 = (int) lNumber;
       Console.WriteLine(number1);
    }
    catch (OverflowException) {
       Console.WriteLine($"{lNumber} is out of range of an Int32.");
    }
    
    double dbl2 = 35901.997;
    try {
       int number2 = (int) dbl2;
       Console.WriteLine(number2);
    }
    catch (OverflowException) {
       Console.WriteLine($"{dbl2} is out of range of an Int32.");
    }
    
    BigInteger bigNumber = 132451;
    try {
       int number3 = (int) bigNumber;
       Console.WriteLine(number3);
    }
    catch (OverflowException) {
       Console.WriteLine($"{bigNumber} is out of range of an Int32.");
    }
    // The example displays the following output:
    //       163245617
    //       35902
    //       132451
    
    let lNumber = 163245617L
    try
        let number1 = int lNumber
        printfn $"{number1}"
    with :? OverflowException ->
        printfn $"{lNumber} is out of range of an Int32."
    
    let dbl2 = 35901.997
    try
        let number2 = int dbl2
        printfn $"{number2}"
    with :? OverflowException ->
        printfn $"{dbl2} is out of range of an Int32."
    
    let bigNumber = BigInteger 132451
    try
        let number3 = int bigNumber
        printfn $"{number3}"
    with :? OverflowException ->
        printfn $"{bigNumber} is out of range of an Int32."
    
    // The example displays the following output:
    //       163245617
    //       35902
    //       132451
    
    Dim lNumber As Long = 163245617
    Try
       Dim number1 As Integer = CInt(lNumber)
       Console.WriteLine(number1)
    Catch e As OverflowException
       Console.WriteLine("{0} is out of range of an Int32.", lNumber)
    End Try
    
    Dim dbl2 As Double = 35901.997
    Try
       Dim number2 As Integer = CInt(dbl2)
       Console.WriteLine(number2)
    Catch e As OverflowException
       Console.WriteLine("{0} is out of range of an Int32.", dbl2)
    End Try
       
    Dim bigNumber As BigInteger = 132451
    Try
       Dim number3 As Integer = CInt(bigNumber)
       Console.WriteLine(number3)
    Catch e As OverflowException
       Console.WriteLine("{0} is out of range of an Int32.", bigNumber)
    End Try    
    ' The example displays the following output:
    '       163245617
    '       35902
    '       132451
    
  • Vous pouvez appeler une méthode de la Convert classe pour convertir n’importe quel type pris en charge en Int32 valeur. Cela est possible, car Int32 prend en charge l’interface IConvertible . L’exemple suivant illustre la conversion d’un tableau de valeurs Decimal vers des valeurs Int32.

    decimal[] values= { Decimal.MinValue, -1034.23m, -12m, 0m, 147m,
                        199.55m, 9214.16m, Decimal.MaxValue };
    int result;
    
    foreach (decimal value in values)
    {
       try {
          result = Convert.ToInt32(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 Int32 type.",
                            value);
       }
    }
    // The example displays the following output:
    //    -79228162514264337593543950335 is outside the range of the Int32 type.
    //    Converted the Decimal value '-1034.23' to the Int32 value -1034.
    //    Converted the Decimal value '-12' to the Int32 value -12.
    //    Converted the Decimal value '0' to the Int32 value 0.
    //    Converted the Decimal value '147' to the Int32 value 147.
    //    Converted the Decimal value '199.55' to the Int32 value 200.
    //    Converted the Decimal value '9214.16' to the Int32 value 9214.
    //    79228162514264337593543950335 is outside the range of the Int32 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.ToInt32 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 Int32 type."
       
    // The example displays the following output:
    //    -79228162514264337593543950335 is outside the range of the Int32 type.
    //    Converted the Decimal value '-1034.23' to the Int32 value -1034.
    //    Converted the Decimal value '-12' to the Int32 value -12.
    //    Converted the Decimal value '0' to the Int32 value 0.
    //    Converted the Decimal value '147' to the Int32 value 147.
    //    Converted the Decimal value '199.55' to the Int32 value 200.
    //    Converted the Decimal value '9214.16' to the Int32 value 9214.
    //    79228162514264337593543950335 is outside the range of the Int32 type.
    
    Dim values() As Decimal = { Decimal.MinValue, -1034.23d, -12d, 0d, 147d, _
                                199.55d, 9214.16d, Decimal.MaxValue }
    Dim result As Integer
    
    For Each value As Decimal In values
       Try
          result = Convert.ToInt32(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 Int32 type.", _
                            value)
       End Try   
    Next                                  
    ' The example displays the following output:
    '    -79228162514264337593543950335 is outside the range of the Int32 type.
    '    Converted the Decimal value '-1034.23' to the Int32 value -1034.
    '    Converted the Decimal value '-12' to the Int32 value -12.
    '    Converted the Decimal value '0' to the Int32 value 0.
    '    Converted the Decimal value '147' to the Int32 value 147.
    '    Converted the Decimal value '199.55' to the Int32 value 200.
    '    Converted the Decimal value '9214.16' to the Int32 value 9214.
    '    79228162514264337593543950335 is outside the range of the Int32 type.
    
  • Vous pouvez appeler la méthode Parse ou TryParse pour convertir la représentation en chaîne d’une valeur Int32 en Int32. La chaîne peut contenir des chiffres décimaux ou hexadécimaux. L’exemple suivant illustre l’opération d’analyse à l’aide d’une chaîne décimale et hexadécimale.

    string string1 = "244681";
    try {
       int number1 = Int32.Parse(string1);
       Console.WriteLine(number1);
    }
    catch (OverflowException) {
       Console.WriteLine($"'{string1}' is out of range of a 32-bit integer.");
    }
    catch (FormatException) {
       Console.WriteLine($"The format of '{string1}' is invalid.");
    }
    
    string string2 = "F9A3C";
    try {
       int number2 = Int32.Parse(string2,
                                System.Globalization.NumberStyles.HexNumber);
       Console.WriteLine(number2);
    }
    catch (OverflowException) {
       Console.WriteLine($"'{string2}' is out of range of a 32-bit integer.");
    }
    catch (FormatException) {
       Console.WriteLine($"The format of '{string2}' is invalid.");
    }
    // The example displays the following output:
    //       244681
    //       1022524
    
    let string1 = "244681"
    try
        let number1 = Int32.Parse string1
        printfn $"{number1}"
    with
    | :? OverflowException ->
        printfn $"'{string1}' is out of range of a 32-bit integer."
    | :? FormatException ->
        printfn $"The format of '{string1}' is invalid."
    
    let string2 = "F9A3C"
    try
        let number2 = Int32.Parse(string2, System.Globalization.NumberStyles.HexNumber)
        printfn $"{number2}"
    with
    | :? OverflowException ->
        printfn $"'{string2}' is out of range of a 32-bit integer."
    | :? FormatException ->
        printfn $"The format of '{string2}' is invalid."
    
    // The example displays the following output:
    //       244681
    //       1022524
    
    Dim string1 As String = "244681"
    Try
       Dim number1 As Integer = Int32.Parse(string1)
       Console.WriteLine(number1)
    Catch e As OverflowException
       Console.WriteLine("'{0}' is out of range of a 32-bit integer.", string1)
    Catch e As FormatException
       Console.WriteLine("The format of '{0}' is invalid.", string1)
    End Try
    
    Dim string2 As String = "F9A3C"
    Try
       Dim number2 As Integer = Int32.Parse(string2,
                                System.Globalization.NumberStyles.HexNumber)
       Console.WriteLine(number2)
    Catch e As OverflowException
       Console.WriteLine("'{0}' is out of range of a 32-bit integer.", string2)
    Catch e As FormatException
       Console.WriteLine("The format of '{0}' is invalid.", string2)
    End Try
    ' The example displays the following output:
    '       244681
    '       1022524
    

Effectuer des opérations sur les valeurs Int32

Le Int32 type prend en charge les opérations mathématiques standard telles que l’addition, la soustraction, la division, la multiplication, la négation et la négation unaire. Comme les autres types intégraux, le Int32 type prend également en charge les opérateurs bit à bit : AND, OR, XOR, décalage à gauche et décalage à droite.

Vous pouvez utiliser les opérateurs numériques standard pour comparer deux valeurs Int32, ou vous pouvez appeler la méthode CompareTo ou Equals.

Vous pouvez également appeler les membres de la Math classe pour effectuer un large éventail d’opérations numériques, notamment obtenir la valeur absolue d’un nombre, calculer le quotient et le reste à partir de la division intégrale, déterminer la valeur maximale ou minimale de deux entiers, obtenir le signe d’un nombre et arrondir un nombre.

Représenter un Int32 sous forme de chaîne

Le Int32 type fournit une prise en charge complète des chaînes de format numérique standard et personnalisées. (Pour plus d’informations, consultez Types de mise en forme, chaînes de format numérique standard et chaînes de format numérique personnalisées.)

Pour mettre en forme une Int32 valeur en tant que chaîne intégrale sans zéros non significatifs, vous pouvez appeler la méthode sans ToString() paramètre. En utilisant le spécificateur de format « D », vous pouvez également inclure un nombre spécifié de zéros non significatifs dans la représentation sous forme de chaîne. En utilisant le spécificateur de format « N », vous pouvez inclure des séparateurs de groupe et spécifier le nombre de chiffres décimaux à afficher dans la représentation sous forme de chaîne du nombre. En utilisant le spécificateur de format « X », vous pouvez représenter une Int32 valeur sous forme de chaîne hexadécimale. L’exemple suivant met en forme les éléments d’un tableau de Int32 valeurs de ces quatre façons.

int[] numbers = { -1403, 0, 169, 1483104 };
foreach (int 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,11:D3}", number);
    // Display value with 1 decimal digit.
    Console.Write("{0,13:N1}", number);
    // Display value as hexadecimal.
    Console.Write("{0,12:X2}", number);
    // Display value with eight hexadecimal digits.
    Console.WriteLine("{0,14:X8}", number);
}
// The example displays the following output:
//    -1403     -->         -1403     -1,403.0    FFFFFA85      FFFFFA85
//    0         -->           000          0.0          00      00000000
//    169       -->           169        169.0          A9      000000A9
//    1483104   -->       1483104  1,483,104.0      16A160      0016A160
let numbers = [| -1403; 0; 169; 1483104 |]
for number in numbers do
    // Display value using default formatting.
    printf $"{number,-8}  -->   "
    // Display value with 3 digits and leading zeros.
    printf $"{number,11:D3}"
    // Display value with 1 decimal digit.
    printf $"{number,13:N1}"
    // Display value as hexadecimal.
    printf $"{number,12:X2}"
    // Display value with eight hexadecimal digits.
    printfn $"{number,14:X8}"


  // The example displays the following output:
  //    -1403     -->         -1403     -1,403.0    FFFFFA85      FFFFFA85
  //    0         -->           000          0.0          00      00000000
  //    169       -->           169        169.0          A9      000000A9
  //    1483104   -->       1483104  1,483,104.0      16A160      0016A160
Dim numbers() As Integer = { -1403, 0, 169, 1483104 }
For Each number As Integer In numbers
   ' Display value using default formatting.
   Console.Write("{0,-8}  -->   ", number.ToString())
   ' Display value with 3 digits and leading zeros.
   Console.Write("{0,11:D3}", number) 
   ' Display value with 1 decimal digit.
   Console.Write("{0,13:N1}", number) 
   ' Display value as hexadecimal.
   Console.Write("{0,12:X2}", number) 
   ' Display value with eight hexadecimal digits.
   Console.WriteLine("{0,14:X8}", number)
Next   
' The example displays the following output:
'    -1403     -->         -1403     -1,403.0    FFFFFA85      FFFFFA85
'    0         -->           000          0.0          00      00000000
'    169       -->           169        169.0          A9      000000A9
'    1483104   -->       1483104  1,483,104.0      16A160      0016A160

Vous pouvez également mettre en forme une Int32 valeur en tant que chaîne binaire, octal, décimale ou hexadécimale en appelant la ToString(Int32, Int32) méthode et en fournissant la base comme deuxième paramètre de la méthode. L’exemple suivant appelle cette méthode pour afficher les représentations binaires, octales et hexadécimales d’un tableau de valeurs entières.

int[] numbers = { -146, 11043, 2781913 };
Console.WriteLine("{0,8}   {1,32}   {2,11}   {3,10}",
                  "Value", "Binary", "Octal", "Hex");
foreach (int number in numbers)
{
    Console.WriteLine("{0,8}   {1,32}   {2,11}   {3,10}",
                      number, Convert.ToString(number, 2),
                      Convert.ToString(number, 8),
                      Convert.ToString(number, 16));
}
// The example displays the following output:
//       Value                             Binary         Octal          Hex
//        -146   11111111111111111111111101101110   37777777556     ffffff6e
//       11043                     10101100100011         25443         2b23
//     2781913             1010100111001011011001      12471331       2a72d9
let numbers = [| -146; 11043; 2781913 |]
printfn $"""{"Value",8}   {"Binary",32}   {"Octal",11}   {"Hex",10}""" 
for number in numbers do
    printfn $"{number,8}   {Convert.ToString(number, 2),32}   {Convert.ToString(number, 8),11}   {Convert.ToString(number, 16),10}"

// The example displays the following output:
//       Value                             Binary         Octal          Hex
//        -146   11111111111111111111111101101110   37777777556     ffffff6e
//       11043                     10101100100011         25443         2b23
//     2781913             1010100111001011011001      12471331       2a72d9
Dim numbers() As Integer = { -146, 11043, 2781913 }
Console.WriteLine("{0,8}   {1,32}   {2,11}   {3,10}", _
                  "Value", "Binary", "Octal", "Hex")
For Each number As Integer In numbers
   Console.WriteLine("{0,8}   {1,32}   {2,11}   {3,10}", _
                     number, Convert.ToString(number, 2), _
                     Convert.ToString(number, 8), _
                     Convert.ToString(number, 16))
Next      
' The example displays the following output:
'       Value                             Binary         Octal          Hex
'        -146   11111111111111111111111101101110   37777777556     ffffff6e
'       11043                     10101100100011         25443         2b23
'     2781913             1010100111001011011001      12471331       2a72d9

Utiliser des valeurs entières 32 bits non décimales

Outre l’utilisation d’entiers individuels comme valeurs décimales, vous pouvez effectuer des opérations au niveau du bit avec des valeurs entières ou utiliser les représentations binaires ou hexadécimales des valeurs entières. Int32 les valeurs sont représentées en 31 bits, avec le bit de trente secondes utilisé comme bit de signe. Les valeurs positives sont représentées à l'aide de la représentation signe et valeur absolue. Les valeurs négatives sont dans la représentation complémentaire de deux. Il est important de garder à l’esprit lorsque vous effectuez des opérations au niveau binaire sur les valeurs Int32 ou lorsque vous travaillez avec des bits individuels. Pour effectuer une opération numérique, booléenne ou de comparaison sur deux valeurs non décimales, les deux valeurs doivent utiliser la même représentation.

Champs

Nom Description
MaxValue

Représente la plus grande valeur possible d’un Int32. Ce champ est constant.

MinValue

Représente la plus petite valeur possible de Int32. Ce champ est constant.

Méthodes

Nom Description
Abs(Int32)

Calcule l’absolu d’une valeur.

BigMul(Int32, Int32)

Produit le produit complet de deux nombres 32 bits.

Clamp(Int32, Int32, Int32)

Limite une valeur à une valeur minimale et maximale inclusive.

CompareTo(Int32)

Compare cette instance à un entier signé 32 bits spécifié et retourne une indication de leurs valeurs relatives.

CompareTo(Object)

Compare cette instance à un objet spécifié et retourne une indication de leurs valeurs relatives.

CopySign(Int32, Int32)

Copie le signe d’une valeur au signe d’une autre valeur.

CreateChecked<TOther>(TOther)

Crée une instance du type actuel à partir d’une valeur, lève une exception de dépassement de capacité pour toutes les valeurs qui se trouvent en dehors de la plage représentée du type actuel.

CreateSaturating<TOther>(TOther)

Crée une instance du type actuel à partir d’une valeur, en saturant toutes les valeurs qui se trouvent en dehors de la plage représentée du type actuel.

CreateTruncating<TOther>(TOther)

Crée une instance du type actuel à partir d’une valeur, tronqué toutes les valeurs qui se trouvent en dehors de la plage représentée du type actuel.

DivRem(Int32, Int32)

Calcule le quotient et le reste de deux valeurs.

Equals(Int32)

Retourne une valeur indiquant si cette instance est égale à une valeur spécifiée Int32 .

Equals(Object)

Retourne une valeur indiquant si cette instance est égale à un objet spécifié.

GetHashCode()

Retourne le code de hachage pour cette instance.

GetTypeCode()

Retourne le TypeCode type Int32valeur .

IsEvenInteger(Int32)

Détermine si une valeur représente un nombre intégral pair.

IsNegative(Int32)

Détermine si une valeur est négative.

IsOddInteger(Int32)

Détermine si une valeur représente un nombre intégral impair.

IsPositive(Int32)

Détermine si une valeur est positive.

IsPow2(Int32)

Détermine si une valeur est une puissance de deux.

LeadingZeroCount(Int32)

Calcule le nombre de zéros non significatifs dans une valeur.

Log10(Int32)

Représente un entier signé 32 bits.

Log2(Int32)

Calcule le journal2 d’une valeur.

Max(Int32, Int32)

Compare deux valeurs au calcul, ce qui est supérieur.

MaxMagnitude(Int32, Int32)

Compare deux valeurs au calcul, ce qui est supérieur.

Min(Int32, Int32)

Compare deux valeurs au calcul, ce qui est inférieur.

MinMagnitude(Int32, Int32)

Compare deux valeurs au calcul, ce qui est inférieur.

Parse(ReadOnlySpan<Byte>, IFormatProvider)

Analyse une étendue de caractères UTF-8 en une valeur.

Parse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider)

Analyse une étendue de caractères UTF-8 en une valeur.

Parse(ReadOnlySpan<Char>, IFormatProvider)

Analyse une étendue de caractères en une valeur.

Parse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider)

Convertit la représentation d’étendue d’un nombre dans un style et un format spécifique à la culture spécifiés en son équivalent entier signé 32 bits.

Parse(String, IFormatProvider)

Convertit la représentation sous forme de chaîne d’un nombre dans un format spécifique à la culture spécifié en entier signé 32 bits équivalent.

Parse(String, NumberStyles, IFormatProvider)

Convertit la représentation sous forme de chaîne d’un nombre dans un format spécifique à la culture et au style spécifié en entier signé 32 bits équivalent.

Parse(String, NumberStyles)

Convertit la représentation sous forme de chaîne d’un nombre dans un style spécifié en son entier signé 32 bits équivalent.

Parse(String)

Convertit la représentation sous forme de chaîne d’un nombre en son entier signé 32 bits équivalent.

PopCount(Int32)

Calcule le nombre de bits définis dans une valeur.

RotateLeft(Int32, Int32)

Fait pivoter une valeur à gauche d’une quantité donnée.

RotateRight(Int32, Int32)

Fait pivoter une valeur à droite d’un montant donné.

Sign(Int32)

Calcule le signe d’une valeur.

ToString()

Convertit la valeur numérique de cette instance en sa représentation sous forme de chaîne équivalente.

ToString(IFormatProvider)

Convertit la valeur numérique de cette instance en sa représentation sous forme de chaîne équivalente à l’aide des informations de format spécifiques à la culture spécifiées.

ToString(String, IFormatProvider)

Convertit la valeur numérique de cette instance en sa représentation sous forme de chaîne équivalente à l’aide des informations de format spécifiques à la culture et au format spécifiés.

ToString(String)

Convertit la valeur numérique de cette instance en sa représentation sous forme de chaîne équivalente, à l’aide du format spécifié.

TrailingZeroCount(Int32)

Calcule le nombre de zéros de fin dans une valeur.

TryFormat(Span<Byte>, Int32, ReadOnlySpan<Char>, IFormatProvider)

Tente de mettre en forme la valeur de l’instance actuelle en UTF-8 dans l’étendue fournie d’octets.

TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider)

Tente de mettre en forme la valeur de l’instance de nombre entier actuel dans l’étendue fournie de caractères.

TryParse(ReadOnlySpan<Byte>, IFormatProvider, Int32)

Tente d’analyser une étendue de caractères UTF-8 en une valeur.

TryParse(ReadOnlySpan<Byte>, Int32)

Tente de convertir une étendue de caractères UTF-8 contenant la représentation sous forme de chaîne d’un nombre en son équivalent entier signé 32 bits.

TryParse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider, Int32)

Tente d’analyser une étendue de caractères UTF-8 en une valeur.

TryParse(ReadOnlySpan<Char>, IFormatProvider, Int32)

Tente d’analyser une étendue de caractères en une valeur.

TryParse(ReadOnlySpan<Char>, Int32)

Convertit la représentation d’étendue d’un nombre dans un format spécifique à la culture en son entier signé 32 bits équivalent. Une valeur de retour indique si la conversion a réussi.

TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, Int32)

Convertit la représentation d’étendue d’un nombre dans un style et un format spécifique à la culture spécifiés en son équivalent entier signé 32 bits. Une valeur de retour indique si la conversion a réussi.

TryParse(String, IFormatProvider, Int32)

Tente d’analyser une chaîne en une valeur.

TryParse(String, Int32)

Convertit la représentation sous forme de chaîne d’un nombre en son entier signé 32 bits équivalent. Une valeur de retour indique si la conversion a réussi.

TryParse(String, NumberStyles, IFormatProvider, Int32)

Convertit la représentation sous forme de chaîne d’un nombre dans un format spécifique à la culture et au style spécifié en entier signé 32 bits équivalent. Une valeur de retour indique si la conversion a réussi.

Implémentations d’interfaces explicites

Nom Description
IAdditionOperators<Int32,Int32,Int32>.Addition(Int32, Int32)

Ajoute deux valeurs ensemble pour calculer leur somme.

IAdditionOperators<Int32,Int32,Int32>.CheckedAddition(Int32, Int32)

Ajoute deux valeurs ensemble pour calculer leur somme.

IAdditiveIdentity<Int32,Int32>.AdditiveIdentity

Obtient l’identité additive du type actuel.

IBinaryInteger<Int32>.GetByteCount()

Obtient le nombre d’octets qui seront écrits dans le cadre de TryWriteLittleEndian(Span<Byte>, Int32).

IBinaryInteger<Int32>.GetShortestBitLength()

Obtient la longueur, en bits, de la représentation complète des deux plus courtes de la valeur actuelle.

IBinaryInteger<Int32>.TryReadBigEndian(ReadOnlySpan<Byte>, Boolean, Int32)

Représente un entier signé 32 bits.

IBinaryInteger<Int32>.TryReadLittleEndian(ReadOnlySpan<Byte>, Boolean, Int32)

Représente un entier signé 32 bits.

IBinaryInteger<Int32>.TryWriteBigEndian(Span<Byte>, Int32)

Tente d’écrire la valeur actuelle, au format big-endian, dans une étendue donnée.

IBinaryInteger<Int32>.TryWriteLittleEndian(Span<Byte>, Int32)

Tente d’écrire la valeur actuelle, au format little-endian, dans une étendue donnée.

IBinaryNumber<Int32>.AllBitsSet

Obtient une instance du type binaire dans laquelle tous les bits sont définis.

IBitwiseOperators<Int32,Int32,Int32>.BitwiseAnd(Int32, Int32)

Calcule les valeurs au niveau du bit et de deux valeurs.

IBitwiseOperators<Int32,Int32,Int32>.BitwiseOr(Int32, Int32)

Calcule les valeurs au niveau du bit ou de deux valeurs.

IBitwiseOperators<Int32,Int32,Int32>.ExclusiveOr(Int32, Int32)

Calcule les valeurs exclusives ou de deux valeurs.

IBitwiseOperators<Int32,Int32,Int32>.OnesComplement(Int32)

Calcule la représentation complète d’une valeur donnée.

IComparable.CompareTo(Object)

Compare cette instance à un objet spécifié et retourne une indication de leurs valeurs relatives.

IComparisonOperators<Int32,Int32,Boolean>.GreaterThan(Int32, Int32)

Compare deux valeurs pour déterminer ce qui est supérieur.

IComparisonOperators<Int32,Int32,Boolean>.GreaterThanOrEqual(Int32, Int32)

Compare deux valeurs pour déterminer qui est supérieur ou égal.

IComparisonOperators<Int32,Int32,Boolean>.LessThan(Int32, Int32)

Compare deux valeurs pour déterminer ce qui est inférieur.

IComparisonOperators<Int32,Int32,Boolean>.LessThanOrEqual(Int32, Int32)

Compare deux valeurs pour déterminer qui est inférieure ou égale.

IConvertible.GetTypeCode()

Retourne le TypeCode type Int32valeur .

IConvertible.ToBoolean(IFormatProvider)

Pour obtenir une description de ce membre, consultez ToBoolean(IFormatProvider).

IConvertible.ToByte(IFormatProvider)

Pour obtenir une description de ce membre, consultez ToByte(IFormatProvider).

IConvertible.ToChar(IFormatProvider)

Pour obtenir une description de ce membre, consultez ToChar(IFormatProvider).

IConvertible.ToDateTime(IFormatProvider)

Cette conversion n’est pas prise en charge. La tentative d’utilisation de cette méthode lève un InvalidCastException.

IConvertible.ToDecimal(IFormatProvider)

Pour obtenir une description de ce membre, consultez ToDecimal(IFormatProvider).

IConvertible.ToDouble(IFormatProvider)

Pour obtenir une description de ce membre, consultez ToDouble(IFormatProvider).

IConvertible.ToInt16(IFormatProvider)

Pour obtenir une description de ce membre, consultez ToInt16(IFormatProvider).

IConvertible.ToInt32(IFormatProvider)

Pour obtenir une description de ce membre, consultez ToInt32(IFormatProvider).

IConvertible.ToInt64(IFormatProvider)

Pour obtenir une description de ce membre, consultez ToInt64(IFormatProvider).

IConvertible.ToSByte(IFormatProvider)

Pour obtenir une description de ce membre, consultez ToSByte(IFormatProvider).

IConvertible.ToSingle(IFormatProvider)

Pour obtenir une description de ce membre, consultez ToSingle(IFormatProvider).

IConvertible.ToType(Type, IFormatProvider)

Pour obtenir une description de ce membre, consultez ToType(Type, IFormatProvider).

IConvertible.ToUInt16(IFormatProvider)

Pour obtenir une description de ce membre, consultez ToUInt16(IFormatProvider).

IConvertible.ToUInt32(IFormatProvider)

Pour obtenir une description de ce membre, consultez ToUInt32(IFormatProvider).

IConvertible.ToUInt64(IFormatProvider)

Pour obtenir une description de ce membre, consultez ToUInt64(IFormatProvider).

IDecrementOperators<Int32>.CheckedDecrement(Int32)

Décrémente une valeur.

IDecrementOperators<Int32>.Decrement(Int32)

Décrémente une valeur.

IDivisionOperators<Int32,Int32,Int32>.Division(Int32, Int32)

Divise une valeur par une autre pour calculer leur quotient.

IEqualityOperators<Int32,Int32,Boolean>.Equality(Int32, Int32)

Compare deux valeurs pour déterminer l’égalité.

IEqualityOperators<Int32,Int32,Boolean>.Inequality(Int32, Int32)

Compare deux valeurs pour déterminer l’inégalité.

IIncrementOperators<Int32>.CheckedIncrement(Int32)

Incrémente une valeur.

IIncrementOperators<Int32>.Increment(Int32)

Incrémente une valeur.

IMinMaxValue<Int32>.MaxValue

Obtient la valeur maximale du type actuel.

IMinMaxValue<Int32>.MinValue

Obtient la valeur minimale du type actuel.

IModulusOperators<Int32,Int32,Int32>.Modulus(Int32, Int32)

Divise deux valeurs ensemble pour calculer leur module ou leur reste.

IMultiplicativeIdentity<Int32,Int32>.MultiplicativeIdentity

Obtient l’identité multiplicative du type actuel.

IMultiplyOperators<Int32,Int32,Int32>.CheckedMultiply(Int32, Int32)

Multiplie deux valeurs ensemble pour calculer leur produit.

IMultiplyOperators<Int32,Int32,Int32>.Multiply(Int32, Int32)

Multiplie deux valeurs ensemble pour calculer leur produit.

INumber<Int32>.MaxNumber(Int32, Int32)

Compare deux valeurs au calcul qui est supérieure et retourne l’autre valeur si une entrée est NaN.

INumber<Int32>.MinNumber(Int32, Int32)

Compare deux valeurs au calcul, ce qui est inférieur et retourne l’autre valeur si une entrée est NaN.

INumberBase<Int32>.IsCanonical(Int32)

Détermine si une valeur se trouve dans sa représentation canonique.

INumberBase<Int32>.IsComplexNumber(Int32)

Détermine si une valeur représente un nombre complexe.

INumberBase<Int32>.IsFinite(Int32)

Détermine si une valeur est finie.

INumberBase<Int32>.IsImaginaryNumber(Int32)

Détermine si une valeur représente un nombre imaginaire pur.

INumberBase<Int32>.IsInfinity(Int32)

Détermine si une valeur est infinie.

INumberBase<Int32>.IsInteger(Int32)

Détermine si une valeur représente un nombre intégral.

INumberBase<Int32>.IsNaN(Int32)

Détermine si une valeur est NaN.

INumberBase<Int32>.IsNegativeInfinity(Int32)

Détermine si une valeur est l’infini négatif.

INumberBase<Int32>.IsNormal(Int32)

Détermine si une valeur est normale.

INumberBase<Int32>.IsPositiveInfinity(Int32)

Détermine si une valeur est l’infini positif.

INumberBase<Int32>.IsRealNumber(Int32)

Détermine si une valeur représente un nombre réel.

INumberBase<Int32>.IsSubnormal(Int32)

Détermine si une valeur est subnormale.

INumberBase<Int32>.IsZero(Int32)

Détermine si une valeur est égale à zéro.

INumberBase<Int32>.MaxMagnitudeNumber(Int32, Int32)

Compare deux valeurs au calcul qui a la plus grande magnitude et retourne l’autre valeur si une entrée est NaN.

INumberBase<Int32>.MinMagnitudeNumber(Int32, Int32)

Compare deux valeurs au calcul dont la magnitude est inférieure et retourne l’autre valeur si une entrée est NaN.

INumberBase<Int32>.MultiplyAddEstimate(Int32, Int32, Int32)

Calcule une estimation de (left * right) + addend.

INumberBase<Int32>.One

Obtient la valeur 1 du type.

INumberBase<Int32>.Radix

Obtient le radix, ou la base, pour le type.

INumberBase<Int32>.TryConvertFromChecked<TOther>(TOther, Int32)

Représente un entier signé 32 bits.

INumberBase<Int32>.TryConvertFromSaturating<TOther>(TOther, Int32)

Représente un entier signé 32 bits.

INumberBase<Int32>.TryConvertFromTruncating<TOther>(TOther, Int32)

Représente un entier signé 32 bits.

INumberBase<Int32>.TryConvertToChecked<TOther>(Int32, TOther)

Tente de convertir une instance du type actuel en un autre type, lève une exception de dépassement de capacité pour toutes les valeurs qui se trouvent en dehors de la plage représentée du type actuel.

INumberBase<Int32>.TryConvertToSaturating<TOther>(Int32, TOther)

Tente de convertir une instance du type actuel en un autre type, en saturant toutes les valeurs qui se trouvent en dehors de la plage représentée du type actuel.

INumberBase<Int32>.TryConvertToTruncating<TOther>(Int32, TOther)

Tente de convertir une instance du type actuel en un autre type, en tronqué toutes les valeurs qui se trouvent en dehors de la plage représentée du type actuel.

INumberBase<Int32>.Zero

Obtient la valeur 0 du type.

IShiftOperators<Int32,Int32,Int32>.LeftShift(Int32, Int32)

Déplace une valeur vers la gauche d’un montant donné.

IShiftOperators<Int32,Int32,Int32>.RightShift(Int32, Int32)

Déplace une valeur à droite d’un montant donné.

IShiftOperators<Int32,Int32,Int32>.UnsignedRightShift(Int32, Int32)

Déplace une valeur à droite d’un montant donné.

ISignedNumber<Int32>.NegativeOne

Obtient la valeur -1 du type.

ISubtractionOperators<Int32,Int32,Int32>.CheckedSubtraction(Int32, Int32)

Soustrait deux valeurs pour calculer leur différence.

ISubtractionOperators<Int32,Int32,Int32>.Subtraction(Int32, Int32)

Soustrait deux valeurs pour calculer leur différence.

IUnaryNegationOperators<Int32,Int32>.CheckedUnaryNegation(Int32)

Calcule la négation unaire vérifiée d’une valeur.

IUnaryNegationOperators<Int32,Int32>.UnaryNegation(Int32)

Calcule la négation unaire d’une valeur.

IUnaryPlusOperators<Int32,Int32>.UnaryPlus(Int32)

Calcule le plus unaire d’une valeur.

S’applique à

Cohérence de thread

Tous les membres de ce type sont thread safe. Les membres qui semblent modifier l’état de l’instance retournent réellement une nouvelle instance initialisée avec la nouvelle valeur. Comme pour tout autre type, la lecture et l’écriture dans une variable partagée qui contient une instance de ce type doit être protégée par un verrou pour garantir la sécurité des threads.

Voir aussi