title: Double.GetHashCode algorithm or override
body: <p>i have an application project that both managed and unmanaged code runs and i need to use the same algorithm for hashing double values in both systems. so either i will override System.Double.GetHashCode() or use its algorithm in c++ code. i could not find the double.gethashcode algorithm and decided to override the function. but i got a strange error. </p>
  
  <blockquote>
    <p>Cannot implicitly convert type double
    to System.Double</p>
  </blockquote>
  
  <p>here is the code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace System
  {
    public struct Double
    {
      unsafe public override int GetHashCode()
      {
        fixed (Double* dd = &amp;this)
        {
          int* xx = (int*)dd;
          return xx[0] ^ xx[1] ;
        }
  
      }
    }
  }
  
  namespace ConsoleApplication1
  {
    class Program
    {
      static void Main(string[] args)
      {
        double dd = 123.3444; // line 1
        // Double dd = 123.3444; // line 2
        // Cannot implicitly convert type double to System.Double
        Console.WriteLine(dd.GetHashCode());
  
        Console.ReadLine();
      }
    }
  }
  </code></pre>
  
  <p>if I uncomment line 2 i get Cannot implicitly convert type double to System.Double
  error. if i run line 1 then no error occurs but the overriden code never works.</p>
  
  <p>maybe it is very bad thing i am trying. so any one knows about the double.gethashcode algorithm, so i can write equivalent c++ code to get the exact int value?</p>