DateTime.GetHashCode() Method in C# Last Updated : 04 Feb, 2019 Comments Improve Suggest changes Like Article Like Report This method is used to return the hash code for this instance. Syntax: public override int GetHashCode (); Return Value: This method returns a 32-bit signed integer hash code. Below programs illustrate the use of DateTime.GetHashCode() Method: Example 1: csharp // C# program to demonstrate the // DateTime.GetHashCode() // Method using System; class GFG { // Main Method public static void Main() { // creating object of DateTime DateTime date = new DateTime(2010, 1, 1, 4, 0, 15); // getting hashcode from DateTime // using GetHashCode() method; int value = date.GetHashCode(); // Display the hashcode Console.WriteLine("hashcode is {0}", value); } } Output: hashcode is 103491886 Example 2: csharp // C# program to demonstrate the // DateTime.GetHashCode() // Method using System; class GFG { // Main Method public static void Main() { // calling check() method check(new DateTime(2010, 1, 3, 4, 0, 15)); check(new DateTime(2010, 1, 5, 4, 0, 15)); } public static void check(DateTime date) { // getting HashCode from DateTime // using GetHashCode() method; int value = date.GetHashCode(); // Display the ShortTime Console.WriteLine("HashCode of {0} is {1}", date, value); } } Output: HashCode of 01/03/2010 04:00:15 is 1802939328 HashCode of 01/05/2010 04:00:15 is -1337841070 Reference: https://docs.microsoft.com/en-us/dotnet/api/system.datetime.gethashcode?view=netframework-4.7.2 Comment More infoAdvertise with us Next Article DateTime.GetHashCode() Method in C# rohitprasad3 Follow Improve Article Tags : C# CSharp-method CSharp DateTime Struct Similar Reads DateTimeOffset.GetHashCode Method in C# DateTimeOffset.GetHashCode Method is used to get the hash code for the current DateTimeOffset object. Syntax: public override int GetHashCode (); Return Value: This method returns a 32-bit signed integer hash code. Below programs illustrate the use of DateTimeOffset.GetHashCode() Method: Example 1: 2 min read DateTime.GetTypeCode() Method in C# This method is used to return the TypeCode for value type DateTime. Syntax: public TypeCode GetTypeCode (); Return Value: This method returns the enumerated constant, DateTime. Below programs illustrate the use of DateTime.GetTypeCode() Method Example 1: csharp // C# program to demonstrate the // Da 1 min read Double.GetHashCode() Method in C# Double.GetHashCode() Method is used to return the hash code for this instance. Syntax: public override int GetHashCode (); Return Value: This method returns a 32-bit signed integer hash code. Below programs illustrate the use of Double.GetHashCode() Method: Example 1: csharp // C# program to demonst 1 min read DateTime.Equals() Method in C# This method is used to get a value indicating whether two DateTime objects, or a DateTime instance and another object or DateTime, have the same value. There are total 3 methods in the overload list of this method: Equals(DateTime, DateTime)Equals(DateTime)Equals(Object)Equals(DateTime, DateTime) Th 5 min read DateTime.FromOADate() Method in C# DateTime.FromOADate(Double) Method is used to return a DateTime equivalent to the specified OLE Automation Date. Syntax: public static DateTime FromOADate (double d); Here, it takes an OLE Automation Date value. Return Value: This method returns an object that represents the same date and time as d. 2 min read Decimal.GetHashCode Method in C# with Examples Decimal.GetHashCode method is used to get the HashCode for the current Decimal instance. Syntax: public override int GetHashCode (); Return Value: This method returns a 32-bit signed integer hash code. Below programs illustrate the use of the above discussed-method: Example 1: csharp // C# program t 1 min read C# | CharEnumerator.GetHashCode() Method GetHashCode() Method serves as the default hash function and returns a hash code for the current object. This method is inherited from the Object class. Syntax: public virtual int GetHashCode (); Return Value: This method returns an Int32 value corresponding to the hash code of the current object. B 2 min read C# | Byte.GetHashCode() Method This method is used to return the hash code for the given byte.Syntax: public override int GetHashCode (); Return Value: This method returns a hash code for the current Byte.Below programs illustrate the use of Byte.GetHashCode() Method:Example 1: CSHARP // C# program to demonstrate // Byte.GetHashC 2 min read Int32.GetHashCode Method in C# with Examples Int32.GetHashCode method is used to get the HashCode for the current Int32 instance. Syntax: public override int GetHashCode (); Return Value: This method returns a 32-bit signed integer hash code. Below programs illustrate the use of the above discussed-method: Example 1: csharp // C# program to il 1 min read Int64.GetHashCode Method in C# with Examples Int64.GetHashCode method is used to get the HashCode for the current Int64 instance. Syntax: public override int GetHashCode (); Return Value: This method returns a 32-bit signed integer hash code. Below programs illustrate the use of the above discussed-method: Example 1: csharp // C# program to il 1 min read Like