Unique keys in Dictionary for class containing longs
<p>If I want to use objects of this class as keys in a Dictionary, what do I need to do? (10.0, 20.0) shouldn't exist as a key twice.</p>

<pre><code>public class IntPoint
{
    public Int64 X { get; set; }
    public Int64 Y { get; set; }

    public IntPoint(Int64 X, Int64 Y)
    {
        this.X = X; this.Y = Y;
    }

    public override int GetHashCode()
    {
        return X.GetHashCode() ^ Y.GetHashCode();
    }
}
</code></pre>

<p><strong>EDIT</strong></p>

<pre><code>public static Dictionary&lt;IntPoint, List&lt;int&gt;&gt; GetPolygonDuplicateIndixes(Polygon p)
{
    Dictionary&lt;IntPoint, List&lt;int&gt;&gt; d = new Dictionary&lt;IntPoint, List&lt;int&gt;&gt;();
    int i = 0;
    foreach(IntPoint point in p)
    {
        if(!d.ContainsKey(point))
        {
            d[point] = new List&lt;int&gt;();
        }
        d[point].Add(i);
        i++;
    }
    ...
</code></pre>

<p>I'm getting duplicates in d. Why? 22002, 1501 occurs twice in p.</p>
