How to get the hash code of a decimal number in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        decimal decimal1 = 7483.891m;
        decimal decimal2 = 87.97434m;
        decimal decimal3 = -98.387367m;
        
        Console.WriteLine(decimal1.GetHashCode());
        Console.WriteLine(decimal2.GetHashCode());
        Console.WriteLine(decimal3.GetHashCode());
    }
}




/*
run:

7418355
8600826
-2049227353

*/

 



answered Aug 5, 2022 by avibootz
edited Aug 5, 2022 by avibootz

Related questions

1 answer 132 views
1 answer 151 views
151 views asked Aug 5, 2022 by avibootz
1 answer 124 views
2 answers 260 views
...