Int32 Estructura
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Representa un entero con signo de 32 bits.
public value class int : IComparable, IComparable<int>, IConvertible, IEquatable<int>, IFormattable
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>, System::Numerics::IDecrementOperators<int>, System::Numerics::IDivisionOperators<int, int, int>, System::Numerics::IEqualityOperators<int, int>, 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>, 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, 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>, System.Numerics.IDecrementOperators<int>, System.Numerics.IDivisionOperators<int,int,int>, System.Numerics.IEqualityOperators<int,int>, 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>, 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 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>
interface IEqualityOperators<int, int>
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>
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 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), IConvertible, IDecrementOperators(Of Integer), IDivisionOperators(Of Integer, Integer, Integer), IEqualityOperators(Of Integer, Integer), 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), 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
- Herencia
- Atributos
- Implementaciones
-
IComparable IComparable<Int32> IConvertible IEquatable<Int32> IFormattable ISpanFormattable IComparable<TOther> IComparable<TSelf> IEquatable<TOther> IEquatable<TSelf> IParsable<Int32> IParsable<TSelf> ISpanParsable<Int32> ISpanParsable<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> System.Numerics.IComparisonOperators<Int32,Int32> System.Numerics.IComparisonOperators<TSelf,TSelf> IDecrementOperators<Int32> IDecrementOperators<TSelf> IDivisionOperators<Int32,Int32,Int32> IDivisionOperators<TSelf,TSelf,TSelf> System.Numerics.IEqualityOperators<Int32,Int32> System.Numerics.IEqualityOperators<TSelf,TOther> System.Numerics.IEqualityOperators<TSelf,TSelf> 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> System.Numerics.IShiftOperators<Int32,Int32> System.Numerics.IShiftOperators<TSelf,TSelf> ISignedNumber<Int32> ISubtractionOperators<Int32,Int32,Int32> ISubtractionOperators<TSelf,TSelf,TSelf> IUnaryNegationOperators<Int32,Int32> IUnaryNegationOperators<TSelf,TSelf> IUnaryPlusOperators<Int32,Int32> IUnaryPlusOperators<TSelf,TSelf>
Comentarios
Int32 es un tipo de valor inmutable que representa enteros con signo con valores que van desde 2.147.483.648 (representados por la Int32.MinValue constante) hasta 2.147.483.647 positivos (representados por la Int32.MaxValue constante). .NET también incluye un tipo de valor entero de 32 bits sin signo, UInt32, que representa valores que van de 0 a 4.294.967.295.
Creación de instancias de un valor Int32
Puede crear una instancia de un Int32 valor de varias maneras:
Puede declarar una Int32 variable y asignarle un valor entero literal que se encuentre dentro del intervalo del tipo de Int32 datos. En el ejemplo siguiente se declaran dos Int32 variables y se les asignan valores de esta manera.
int number1 = 64301; int number2 = 25548612;
let number1 = 64301 let number2 = 25548612
Dim number1 As Integer = 64301 Dim number2 As Integer = 25548612
Puede asignar el valor de un tipo entero cuyo intervalo es un subconjunto del Int32 tipo. Se trata de una conversión de ampliación que no requiere un operador de conversión en C# o un método de conversión en Visual Basic, pero que requiere uno 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
Puede asignar el valor de un tipo numérico cuyo intervalo supere el Int32 del tipo. Se trata de una conversión de restricción, por lo que requiere un operador de conversión en C# o F#, y un método de conversión en Visual Basic si
Option Strict
está activado. Si el valor numérico es un Singlevalor , Doubleo Decimal que incluye un componente fraccionado, el control de su parte fraccionarcional depende del compilador que realiza la conversión. En el ejemplo siguiente se realizan conversiones de restricción para asignar varios valores numéricos a Int32 variables.long lNumber = 163245617; try { int number1 = (int) lNumber; Console.WriteLine(number1); } catch (OverflowException) { Console.WriteLine("{0} is out of range of an Int32.", lNumber); } double dbl2 = 35901.997; try { int number2 = (int) dbl2; Console.WriteLine(number2); } catch (OverflowException) { Console.WriteLine("{0} is out of range of an Int32.", dbl2); } BigInteger bigNumber = 132451; try { int number3 = (int) bigNumber; Console.WriteLine(number3); } catch (OverflowException) { Console.WriteLine("{0} is out of range of an Int32.", bigNumber); } // 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
Puede llamar a un método de la Convert clase para convertir cualquier tipo admitido en un Int32 valor. Esto es posible porque Int32 admite la IConvertible interfaz . En el ejemplo siguiente se muestra la conversión de una matriz de Decimal valores a Int32 valores.
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.
Puede llamar al Parse método o TryParse para convertir la representación de cadena de un Int32 valor en .Int32 La cadena puede contener dígitos decimales o hexadecimales. En el ejemplo siguiente se muestra la operación de análisis mediante una cadena decimal y una cadena hexadecimal.
string string1 = "244681"; try { int number1 = Int32.Parse(string1); Console.WriteLine(number1); } catch (OverflowException) { Console.WriteLine("'{0}' is out of range of a 32-bit integer.", string1); } catch (FormatException) { Console.WriteLine("The format of '{0}' is invalid.", string1); } string string2 = "F9A3C"; try { int number2 = Int32.Parse(string2, System.Globalization.NumberStyles.HexNumber); Console.WriteLine(number2); } catch (OverflowException) { Console.WriteLine("'{0}' is out of range of a 32-bit integer.", string2); } catch (FormatException) { Console.WriteLine("The format of '{0}' is invalid.", string2); } // 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
Realizar operaciones en valores int32
El Int32 tipo admite operaciones matemáticas estándar como suma, resta, división, multiplicación, negación y negación unaria. Al igual que los otros tipos enteros, el Int32 tipo también admite los operadores bit a AND
bit , OR
, XOR
, desplazamiento a la izquierda y desplazamiento a la derecha.
Puede usar los operadores numéricos estándar para comparar dos Int32 valores o puede llamar al CompareTo método o Equals .
También puede llamar a los miembros de la Math clase para realizar una amplia gama de operaciones numéricas, incluida la obtención del valor absoluto de un número, el cálculo del cociente y el resto de la división integral, determinar el valor máximo o mínimo de dos enteros, obtener el signo de un número y redondear un número.
Representación de int32 como una cadena
El Int32 tipo proporciona compatibilidad completa con cadenas de formato numérico estándar y personalizado. (Para obtener más información, vea Aplicar formato a tipos, cadenas de formato numérico estándar y cadenas de formato numérico personalizado).
Para dar formato a un Int32 valor como una cadena integral sin ceros a la izquierda, puede llamar al método sin ToString() parámetros. Mediante el especificador de formato "D", también puede incluir un número especificado de ceros a la izquierda en la representación de cadena. Mediante el especificador de formato "N", puede incluir separadores de grupo y especificar el número de dígitos decimales que se mostrarán en la representación de cadena del número. Mediante el especificador de formato "X", puede representar un Int32 valor como una cadena hexadecimal. En el ejemplo siguiente se da formato a los elementos de una matriz de valores de Int32 estas cuatro maneras.
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
También puede dar formato a un Int32 valor como una cadena binaria, octal, decimal o hexadecimal llamando al ToString(Int32, Int32) método y proporcionando la base como segundo parámetro del método. En el ejemplo siguiente se llama a este método para mostrar las representaciones binarias, octales y hexadecimales de una matriz de valores enteros.
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
Trabajar con valores enteros no decimales de 32 bits
Además de trabajar con enteros individuales como valores decimales, es posible que desee realizar operaciones bit a bit con valores enteros o trabajar con las representaciones binarias o hexadecimales de valores enteros. Int32 los valores se representan en 31 bits, con el bit de treinta segundos que se usa como bit de signo. Los valores positivos se representan mediante la representación de signo y magnitud. Los valores negativos se encuentran en la representación complementaria de dos. Esto es importante tener en cuenta cuando se realizan operaciones bit a bit en Int32 valores o cuando se trabaja con bits individuales. Para realizar una operación numérica, booleana o de comparación en dos valores no decimales, ambos valores deben usar la misma representación.
Campos
MaxValue |
Representa el mayor valor posible de un Int32. Este campo es constante. |
MinValue |
Representa el menor valor posible de Int32. Este campo es constante. |
Métodos
Abs(Int32) |
Calcula el valor absoluto de un valor. |
Clamp(Int32, Int32, Int32) |
Sujeta un valor a un valor mínimo inclusivo y máximo. |
CompareTo(Int32) |
Compara esta instancia con un entero con signo de 32 bits y devuelve una indicación de los valores relativos. |
CompareTo(Object) |
Compara esta instancia con un objeto especificado y devuelve una indicación de los valores relativos. |
CopySign(Int32, Int32) |
Copia el signo de un valor en el signo de otro valor. |
CreateChecked<TOther>(TOther) |
Crea una instancia del tipo actual a partir de un valor, iniciando una excepción de desbordamiento para los valores que se encuentran fuera del intervalo representable del tipo actual. |
CreateSaturating<TOther>(TOther) |
Crea una instancia del tipo actual a partir de un valor, saturando los valores que se encuentran fuera del intervalo representable del tipo actual. |
CreateTruncating<TOther>(TOther) |
Crea una instancia del tipo actual a partir de un valor, truncando los valores que se encuentran fuera del intervalo representable del tipo actual. |
DivRem(Int32, Int32) |
Calcula el cociente y el resto de dos valores. |
Equals(Int32) |
Devuelve un valor que indica si esta instancia equivale a un valor de Int32 especificado. |
Equals(Object) |
Devuelve un valor que indica si esta instancia equivale a un objeto especificado. |
GetHashCode() |
Devuelve el código hash de esta instancia. |
GetTypeCode() | |
IsEvenInteger(Int32) |
Determina si un valor representa un número entero par. |
IsNegative(Int32) |
Determina si un valor es negativo. |
IsOddInteger(Int32) |
Determina si un valor representa un número entero impar. |
IsPositive(Int32) |
Determina si un valor es positivo. |
IsPow2(Int32) |
Determina si un valor es una potencia de dos. |
LeadingZeroCount(Int32) |
Calcula el número de ceros a la izquierda en un valor. |
Log2(Int32) |
Calcula el registro2 de un valor. |
Max(Int32, Int32) |
Compara dos valores con el proceso, que es mayor. |
MaxMagnitude(Int32, Int32) |
Compara dos valores con el proceso, que es mayor. |
Min(Int32, Int32) |
Compara dos valores con el proceso, que es menor. |
MinMagnitude(Int32, Int32) |
Compara dos valores con el proceso, que es menor. |
Parse(ReadOnlySpan<Char>, IFormatProvider) |
Analiza un intervalo de caracteres en un valor. |
Parse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider) |
Convierte la representación de intervalo de un número con el estilo y el formato específicos de la referencia cultural que se hayan especificado en el entero con signo de 32 bits equivalente. |
Parse(String) |
Convierte la representación en forma de cadena de un número en el entero de 32 bits con signo equivalente. |
Parse(String, IFormatProvider) |
Convierte la representación en forma de cadena de un número en el formato específico de la referencia cultural que se haya especificado en el entero de 32 bits con signo equivalente. |
Parse(String, NumberStyles) |
Convierte la representación en forma de cadena de un número con el estilo especificado en el entero de 32 bits con signo equivalente. |
Parse(String, NumberStyles, IFormatProvider) |
Convierte la representación en forma de cadena de un número con el estilo y el formato específico de la referencia cultural que se hayan especificado en el entero de 32 bits con signo equivalente. |
PopCount(Int32) |
Calcula el número de bits establecidos en un valor. |
RotateLeft(Int32, Int32) |
Gira un valor a la izquierda por una cantidad determinada. |
RotateRight(Int32, Int32) |
Gira un valor a la derecha por una cantidad determinada. |
Sign(Int32) |
Calcula el signo de un valor. |
ToString() |
Convierte el valor numérico de esta instancia en la representación de cadena equivalente. |
ToString(IFormatProvider) |
Convierte el valor numérico de esta instancia en la representación de cadena equivalente usando la información de formato específica de la referencia cultural especificada. |
ToString(String) |
Convierte el valor numérico de esta instancia en la representación de cadena equivalente usando el formato especificado. |
ToString(String, IFormatProvider) |
Convierte el valor numérico de esta instancia en su representación de cadena equivalente mediante el formato y la información de formato específica de la referencia cultural que se especificaran. |
TrailingZeroCount(Int32) |
Calcula el número de ceros finales en un valor. |
TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider) |
Intenta dar formato al valor de la instancia del número entero actual en el intervalo de caracteres proporcionado. |
TryParse(ReadOnlySpan<Char>, IFormatProvider, Int32) |
Intenta analizar un intervalo de caracteres en un valor. |
TryParse(ReadOnlySpan<Char>, Int32) |
Convierte la representación de intervalo de un número con el estilo y el formato específicos de la referencia cultural que se hayan especificado en el entero con signo de 32 bits equivalente. Un valor devuelto indica si la conversión se realizó correctamente. |
TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, Int32) |
Convierte la representación de intervalo de un número con el estilo y el formato específicos de la referencia cultural que se hayan especificado en el entero con signo de 32 bits equivalente. Un valor devuelto indica si la conversión se realizó correctamente. |
TryParse(String, IFormatProvider, Int32) | |
TryParse(String, Int32) |
Convierte la representación en forma de cadena de un número en el entero de 32 bits con signo equivalente. Un valor devuelto indica si la conversión se realizó correctamente. |
TryParse(String, NumberStyles, IFormatProvider, Int32) |
Convierte la representación en forma de cadena de un número con el estilo y el formato específico de la referencia cultural que se hayan especificado en el entero de 32 bits con signo equivalente. Un valor devuelto indica si la conversión se realizó correctamente. |
Implementaciones de interfaz explícitas
IBinaryInteger<Int32>.GetByteCount() |
Obtiene el número de bytes que se escribirán como parte de TryWriteLittleEndian(Span<Byte>, Int32). |
IBinaryInteger<Int32>.GetShortestBitLength() |
Obtiene la longitud, en bits, de la representación complementaria de dos más corta del valor actual. |
IBinaryInteger<Int32>.TryWriteBigEndian(Span<Byte>, Int32) |
Intenta escribir el valor actual, en formato big-endian, en un intervalo determinado. |
IBinaryInteger<Int32>.TryWriteLittleEndian(Span<Byte>, Int32) |
Intenta escribir el valor actual, en formato little-endian, en un intervalo determinado. |
IComparable.CompareTo(Object) |
Compara esta instancia con un objeto especificado y devuelve una indicación de los valores relativos. |
IConvertible.GetTypeCode() | |
IConvertible.ToBoolean(IFormatProvider) |
Para obtener una descripción de este miembro, vea ToBoolean(IFormatProvider). |
IConvertible.ToByte(IFormatProvider) |
Para obtener una descripción de este miembro, vea ToByte(IFormatProvider). |
IConvertible.ToChar(IFormatProvider) |
Para obtener una descripción de este miembro, vea ToChar(IFormatProvider). |
IConvertible.ToDateTime(IFormatProvider) |
No se admite esta conversión. Cualquier intento de usar este método produce una excepción InvalidCastException. |
IConvertible.ToDecimal(IFormatProvider) |
Para obtener una descripción de este miembro, vea ToDecimal(IFormatProvider). |
IConvertible.ToDouble(IFormatProvider) |
Para obtener una descripción de este miembro, vea ToDouble(IFormatProvider). |
IConvertible.ToInt16(IFormatProvider) |
Para obtener una descripción de este miembro, vea ToInt16(IFormatProvider). |
IConvertible.ToInt32(IFormatProvider) |
Para obtener una descripción de este miembro, vea ToInt32(IFormatProvider). |
IConvertible.ToInt64(IFormatProvider) |
Para obtener una descripción de este miembro, vea ToInt64(IFormatProvider). |
IConvertible.ToSByte(IFormatProvider) |
Para obtener una descripción de este miembro, vea ToSByte(IFormatProvider). |
IConvertible.ToSingle(IFormatProvider) |
Para obtener una descripción de este miembro, vea ToSingle(IFormatProvider). |
IConvertible.ToType(Type, IFormatProvider) |
Para obtener una descripción de este miembro, vea ToType(Type, IFormatProvider). |
IConvertible.ToUInt16(IFormatProvider) |
Para obtener una descripción de este miembro, vea ToUInt16(IFormatProvider). |
IConvertible.ToUInt32(IFormatProvider) |
Para obtener una descripción de este miembro, vea ToUInt32(IFormatProvider). |
IConvertible.ToUInt64(IFormatProvider) |
Para obtener una descripción de este miembro, vea ToUInt64(IFormatProvider). |
Se aplica a
Seguridad para subprocesos
Todos los miembros de este tipo son seguros para subprocesos. Los miembros que parecen modificar el estado de la instancia devuelven realmente una nueva instancia inicializada con el nuevo valor. Al igual que con cualquier otro tipo, la lectura y escritura en una variable compartida que contiene una instancia de este tipo deben estar protegidas por un bloqueo para garantizar la seguridad de los subprocesos.