C# String GetHashCode() Method
You are Here:
C# String GetHashCode()
The GetHashCode()
method returns a hash code for this string.
This method is located in mscorlib. It uses unsafe code (with shifts and bitwise operations) to compute well-distributed hash codes.
Note: In C#, the hash code keeps changing.
Example
C# Compiler
using System;
namespace myApp
{
class Program
{
static void Main(string[] args)
{
string s = "wikimass";
Console.WriteLine(s.GetHashCode());
}
}
}
Output
-303305275
Syntax
public override int GetHashCode()
Parameter Values
It does not take any argument.
Return Value
Value | Explanation |
---|---|
Number (Int) | Returns a hash code value for this object. |
Reminder
Hi Developers, we almost covered 90% of String functions and Interview Question on C# with examples for quick and easy learning.
We are working to cover every Single Concept in C#.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.