Equals()とGetHashCode()の実装

public class Hoge : IEquatable<Hoge>
{

    public int x;
    public int y;

    public override bool Equals(object args)
    {
        if (object.ReferenceEquals(args, null))
        {
            return false;
        }

        if (object.ReferenceEquals(this, args))
        {
            return true;
        }

        if (this.GetType() != args.GetType())
        {
            return false;
        }

        return this.Equals((Hoge)args);
    }

    public bool Equals(Hoge args)
    {
        return this.x == args.x && this.y == args.y;
    }

    public override int GetHashCode()
    {
        int intResult = 1;

        intResult = intResult * 31 + this.x;
        intResult = intResult * 31 + this.y;

        return intResult;
    }
}