I want to sort a List<Tuple<Vertex, Vertex>>, i.e. a list of tuples, where each tuple contains a certain amount of vertices.
Vertex is a custom class, List and Tuple are from System.
I already have several Comparers that provide a way to compare two vertices, e.g.:
class MyVertexComparer1 : Comparer<Vertex> and class MyVertexComparer2 : Comparer<Vertex>
Now I would like to use these existing Comparers to sort the list according to the default tuple comparision, i.e. comparing the first entry and only in case of a tie comparing the next entry.
The comparision of two tuples within this sorting should be determined by one of the custom VertexComparers.
I know I could write a class MyTupleComparer : Comparer<Tuple<Vertex, Vertex>> that uses the MyVertexComparer in its implementation, maybe with a generic parameter that specifies which VertexComparer to use.
However, this feels wrong as I would simply repeat the default comparision for tuples.
Moreover, I do not see how this could be extended to tuples with more than two vertices without a dedicated comparer class for each number of vertices.