C# Int 64 Struct Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report 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.Range: Int64 ranges from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807.Bitwise Operations: It supports bitwise operations like AND (&), OR (|), XOR (^), NOT (~), and shifts (<<, >>).Convert and Math Class Compatibility: It works with methods from Convert and Math classes for operations like rounding, absolute value, and power calculations.FieldsFieldsDescriptionMaxValueThis field is used to represent the largest possible value of an Int64. This field is constant.MinValueThis field is used to represent the smallest possible value of an Int64. This field is constant.Example: Using MaxValue and MinValue Fields C# // C# program to demonstrate // MaxValue and MinValue fields using System; class Geeks { static public void Main() { // Declaring and initializing Int64 values long v1 = 89; long v2 = 50; long v3 = 10; Console.WriteLine("Value 1: {0}", v1); Console.WriteLine("Value 2: {0}", v2); Console.WriteLine("Value 3: {0}", v3); // Displaying MaxValue and MinValue Console.WriteLine("Maximum Value: {0}" , long.MaxValue); Console.WriteLine("Minimum Value: {0}" , long.MinValue); } } OutputValue 1: 89 Value 2: 50 Value 3: 10 Maximum Value: 9223372036854775807 Minimum Value: -9223372036854775808 MethodsMethodDescriptionCompareTo()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 C# // C# program to demonstrate the Int64.Equals() method using System; class Geeks { public static void Main() { // Declaring and initializing values long v1 = 45643212342; long v2 = 543256344233; // Using Equals() method bool status = v1.Equals(v2); if (status) Console.WriteLine("{0} is equal to {1}", v1, v2); else Console.WriteLine("{0} is not equal to {1}", v1, v2); } } Output45643212342 is not equal to 543256344233 Example 2: Using GetTypeCode() Method C# // C# program to illustrate GetTypeCode() method using System; class Geeks { static public void Main() { // Declaring an Int64 value long value = 45789478123; // Getting the type code // using GetTypeCode() method TypeCode res = value.GetTypeCode(); // Displaying the TypeCode Console.WriteLine("TypeCode for Int64 is: {0}", res); } } OutputTypeCode for Int64 is: Int64 Bitwise Operations with Int64Example: C# // C# program to demonstrate bitwise operations on Int64 using System; class Geeks { static void Main() { long a = 5; long b = 3; // Performing bitwise operations Console.WriteLine("Bitwise AND (a & b): " + (a & b)); Console.WriteLine("Bitwise OR (a | b): " + (a | b)); Console.WriteLine("Bitwise XOR (a ^ b): " + (a ^ b)); Console.WriteLine("Bitwise NOT (~a): " + (~a)); } } OutputBitwise AND (a & b): 1 Bitwise OR (a | b): 7 Bitwise XOR (a ^ b): 6 Bitwise NOT (~a): -6 Comment More infoAdvertise with us Next Article C# Int16 Struct A ankita_saini Follow Improve Article Tags : C# CSharp-Int64-Struct Similar Reads C# Int32 Struct 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 3 min read C# Int32 Struct 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 3 min read C# Int16 Struct In C#, Int16 Struct defined under the System namespace represents a 16-bit signed integer also known as a short datatype etc. We can also call the methods of math class to perform mathematical operations. Int16 struct inherits the ValueType class which inherits the Object class. Characteristics are 3 min read C# Int16 Struct In C#, Int16 Struct defined under the System namespace represents a 16-bit signed integer also known as a short datatype etc. We can also call the methods of math class to perform mathematical operations. Int16 struct inherits the ValueType class which inherits the Object class. Characteristics are 3 min read C# | Structures | Set - 1 Structure is a value type and a collection of variables of different data types under a single unit. It is almost similar to a class because both are user-defined data types and both hold a bunch of different data types. C# provide the ability to use pre-defined data types. However, sometimes the us 4 min read C# | Structures | Set - 1 Structure is a value type and a collection of variables of different data types under a single unit. It is almost similar to a class because both are user-defined data types and both hold a bunch of different data types. C# provide the ability to use pre-defined data types. However, sometimes the us 4 min read Like