using icomparer

so i need to pass an icomparer method to sort I checked the documentation at

basically my problem is when i write

public  class CompareYNeg : IComparer
	{
		IComparer.Compare(Vector3 first, Vector3 second)
		{
		if (first.y > second.y)
			return -1;
		if (first.y < second.y)
			return 1;
		else 
			return 0;
		}
	}

Icompare.Compare isn’t an option

i get

Icomparer.equals
or
Icomparer.Referenceequals

the really wierd thing is if i try to compile it with a working function name with no errors because i inherited form Icomparer it says error didnt define Icomparer.compare basically.

So it knows about it and knows it exists but wont let me speak of it.

So, if anyone else stumbles across this, you can copy the passed objects to local Vector3s like this:

public int  Compare (object _first, object _second) {
	Vector3 first = _first as Vector3;
	Vector3 second = _second as Vector3;
	if (first.y > second.y)
		return -1;
	if (first.y < second.y)
		return 1;
	else 
	return 0;
}

or this:

Vector3 first = (Vector3) _first;
Vector3 second = (Vector3) _second;

For more information, see Use comparison interfaces in Visual C# - C# | Microsoft Learn