![]() |
VOOZH | about |
In C#, the Int32 struct represents a 32-bit signed integer and is commonly used as the int data type. It belongs to the System namespace and provides various methods to perform operations like mathematical computations, parsing, and type conversion. The Int32 struct inherits from ValueType, which in turn inherits from Object.
Example:
Value 1: 34 Value 2: 30 Value 3: 59 Maximum Value: 2147483647 Minimum Value: -2147483648
Method | Description |
|---|---|
CompareTo() | Compare the current instance to a specified object and return an indication of their relative values. ( 0, 1 or -1) |
This method is used to return a value indicating whether the current instance is equal to a specified object or Int32. | |
This method is used to return the hash code for this instance. | |
This method is used to return the TypeCode for value type Int32. | |
Parse() | Used to convert the string representation of a number to its 32-bit signed integer equivalent. |
Used to convert the numeric value of this instance to its equivalent string representation. | |
TryParse() | Converts a number string to a 32-bit signed integer and indicates success (true or false) |
Example 1: Using Equals() Method
70 is not equal to 89
Example 2: Using GetTypeCode() Method
Type code of var1: Int32 Type code of var2: Int32 Type code of var3: Int32
Bitwise AND (a & b): 1 Bitwise OR (a | b): 7 Bitwise XOR (a ^ b): 6 Bitwise NOT (~a): -6