![]() |
VOOZH | about |
In C#, the Int64 struct represents a 64-bit signed integer and is commonly used as the long data type. It belongs to the System namespace and provides various methods to perform operations like mathematical computations, parsing, and type conversion. The Int64 struct inherits from ValueType, which in turn inherits from Object.
| Fields | Description |
|---|---|
| MaxValue | This field is used to represent the largest possible value of an Int64. This field is constant. |
| MinValue | This field is used to represent the smallest possible value of an Int64. This field is constant. |
Example: Using MaxValue and MinValue Fields
Value 1: 89 Value 2: 50 Value 3: 10 Maximum Value: 9223372036854775807 Minimum Value: -9223372036854775808
| Method | Description |
|---|---|
| CompareTo() | This method is used to compare this instance to a specified object or Int64 and returns an indication of their relative values. |
| Equals() | This method is used to return a value indicating whether this instance is equal to a specified object or Int64. |
| GetHashCode() | This method is used to return the hash code for this instance. |
| GetTypeCode() | This method is used to return the TypeCode for value type Int64. |
| Parse() | This method is used to convert the string representation of a number to its 64-bit signed integer equivalent. |
| ToString() | This method is used to convert the numeric value of this instance to its equivalent string representation. |
| TryParse() | This method is used to convert the string representation of a number to its 64-bit signed integer equivalent. A return value indicates whether the conversion succeeded or failed. |
Example 1: Using Equals() Method
45643212342 is not equal to 543256344233
Example 2: Using GetTypeCode() Method
TypeCode for Int64 is: Int64
Example:
Bitwise AND (a & b): 1 Bitwise OR (a | b): 7 Bitwise XOR (a ^ b): 6 Bitwise NOT (~a): -6