C # - definiowanie skrótu z kluczem niestandardowym

UżywamHashSet iDictionary w C # do zaimplementowania struktury Graph. Mam problem z wyjątkowościąHashSet elementy, gdyHashSet klucz to dostosowana klasa. Oto mam:

public class Point
{
    public int x { get; set; }
    public int y { get; set; }
}

public class Vertex
{
    public Vertex(Point point)
    {
        VertexLabel = point;
    }

    public Point VertexLabel { get; private set; }
}

public class Edge
{
    public Edge(Vertex to, Vertex from, double weight)
    {
        FromVertex = from;
        ToVertex = to;
        Weight = weight;
    }

    public Vertex FromVertex { get; private set; }
    public Vertex ToVertex { get; private set; }
    public double Weight { get; private set; }
}

public class Graph
{
    public Graph()
    {
        _Vertexes = new HashSet<Vertex>();
        _VertexEdgeMapping = new Dictionary<Vertex, LinkedList<Edge>>();
    }
    private HashSet<Vertex> _Vertexes;
    private Dictionary<Vertex, LinkedList<Edge>> _VertexEdgeMapping;
}

Problem polega na tym, że kiedy mam te same wierzchołki i chcę je dodać do wykresu, są one duplikowane. jak mogę zdefiniować sposób, w jakiHashSet zrozumie wyjątkowość moich wierzchołków?

questionAnswers(3)

yourAnswerToTheQuestion