Single.GetHashCode() Method in C# with Examples
Single.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 Single.GetHashCode() Method:
Example 1:
using System;
using System.Globalization;
class GFG {
public static void Main()
{
float value1 = 10f;
int value = value1.GetHashCode();
Console.WriteLine( "HashCode is {0}" , value);
}
}
|
Output:
HashCode is 1092616192
Example 2:
using System;
using System.Globalization;
class GFG {
public static void Main()
{
get (5f);
get (9.5f);
get (10000f);
get (2327.5232f);
}
public static void get ( float value1)
{
int value = value1.GetHashCode();
Console.WriteLine( "HashCode is {0}" , value);
}
}
|
Output:
HashCode is 1084227584
HashCode is 1092091904
HashCode is 1176256512
HashCode is 1158772831
Reference:
Last Updated :
01 May, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...