Int32 Struct
Represents a 32-bit signed integer.
The Int32 structure represents an integer whose value ranges from negative 2,147,483,648 to positive 2,147,483,647. This value type is the underlying type for the Int32 structure.
The Int32 structure provides a number of methods for working with integers, including methods for converting integers to strings, parsing strings into integers, and performing bitwise operations.
Syntax
Remarks
The Int32 structure is the C# keyword int. In .NET, int is an alias for System.Int32.
The range of Int32 is from Int32.MinValue (-2,147,483,648) to Int32.MaxValue (2,147,483,647).
The Int32 structure supports standard arithmetic operations:
- Addition (+)
- Subtraction (-)
- Multiplication (*)
- Division (/)
- Modulo (%)
It also supports bitwise operations:
- Bitwise AND (&)
- Bitwise OR (|)
- Bitwise XOR (^)
- Bitwise NOT (~)
- Left Shift (<<)
- Right Shift (>>)
Fields
| Name | Description |
|---|---|
MinValue |
Represents the minimum value of a 32-bit signed integer. This field is constant. |
MaxValue |
Represents the maximum value of a 32-bit signed integer. This field is constant. |
Methods
Operators
The Int32 structure overloads the following operators:
+ (Addition)- (Subtraction)* (Multiplication)/ (Division)% (Modulo)== (Equality)!= (Inequality)< (Less than)> (Greater than)<= (Less than or equal to)>= (Greater than or equal to)& (Bitwise AND)| (Bitwise OR)^ (Bitwise XOR)~ (Bitwise NOT)<< (Left Shift)>> (Right Shift)Conversions
The Int32 structure supports implicit and explicit conversions to and from other numeric types.
Implicit Conversions
Implicit conversions are supported from the following types to Int32:
bytesbyteshortushortchar
Explicit Conversions
Explicit conversions are supported to and from the following types:
longulongfloatdoubledecimalBigInteger
Implements
The Int32 structure implements the following interfaces:
Example
The following example demonstrates basic operations with the Int32 structure: