I have a class that looks like this.
public class Point : IEquatable<Point>
{
public int _xValue {get;set;}
public double _yValue {get;set;}
public Point(int x, double y)
{
_xValue = x;
_yValue = y;
}
public override bool Equals(object obj)
{
return Equals(obj as Point);
}
public bool Equals(Point obj)
{
return obj != null && obj._xValue == this._xValue && obj._yValue == this._yValue;
}
}
I have to implement the GetHashCode
function so that I can use it as a dictionary key. But I'm not clear on what the GetHashCode
function has to return in this situation. Can someone help me out?