I need to write a comparer for a core class in C#. I have a SortedSet<Vector2> and in order to iterate through it I need a basic comparer. Nothing fancy needed as I just need to access each element in the collection in any order. But Vector2 (Microsoft.Xna.Framework.Graphics) is a compiled dll without a default comparer.
My SortedSet has a property Comparer but I cannot figure how to assign Comparer a Vector2 comparer.
You need to create your own class which implements
IComparer<Vector2>and then constructor yourSortedSetwith it:Your comparer just needs to implement the single method
Compare: