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
using System;
using System.Globalization;
class GFG {
public static void Main()
{
double value1 = 10d;
int value = value1.GetHashCode();
Console.WriteLine("HashCode is {0}", value);
}
}
|
Output:
HashCode is 1076101120
Example 2:
csharp
using System;
using System.Globalization;
class GFG {
public static void Main()
{
get (5d);
get (5.5d);
get (10d);
get (7.5d);
}
public static void get ( double value1)
{
int value = value1.GetHashCode();
Console.WriteLine("HashCode is {0}", value);
}
}
|
Output:
HashCode is 1075052544
HashCode is 1075183616
HashCode is 1076101120
HashCode is 1075707904
Reference:
Last Updated :
18 Jan, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...