How to get the hash code of a string in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        string str1 = "C# Software Developer";
        Console.WriteLine(str1.GetHashCode());
        
        string str2 = "C# Software Developer";
        Console.WriteLine(str2.GetHashCode());
        
        string str3 = "java c# python";
        Console.WriteLine(str3.GetHashCode());
    }
}




/*
run:

-1635471873
-1635471873
1264750924

*/

 



answered Aug 5, 2022 by avibootz

Related questions

1 answer 152 views
1 answer 124 views
1 answer 132 views
2 answers 260 views
...