Need help understanding how List <T> .Sort (IComparer (T)) knows the value to sort by

I am working on a program (C # training) that creates an object (Card), and in the program it sorts a deck of cards by value. What puzzles me is how he can sort the deck of cards by the value of the cards when the instance of the object is not a parameter passed to the method, but an object of the class. Below is the code that will help answer my question - I would execute this if I were to pass an instance of the object.

Class for creating an object:

class Card
{
    public Suits Suit { get; set; }
    public Values Value { get; set; }

    public Card(Suits suit, Values value)
    {
        this.Suit = suit;
        this.Value = value;
    }

    public string Name
    {
        get { return Value.ToString() + " of " + Suit.ToString(); }
    }

    public override string ToString()
    {
        return Name;
    }
}

In another class, I call a method that instantiates an object (CardComparer_byValue), which inherits from the IComparer interface. That's where my confusion comes in.

public void SortByValue() {
cards.Sort(new CardComparer_byValue());
} 

And the SortByValue class

class CardComparer_byValue : IComparer<Card>
{
    public int Compare(Card x, Card y)
    {
        if (x.Value > y.Value)
            return 1;
        if (x.Value < y.Value)
            return -1;
        if (x.Suit > y.Suit)
            return 1;
        if (x.Suit < y.Suit)
            return -1;
        return 0;
    }

} 

I would have thought that the aforementioned "SortByValue" method was called like this

Card mycard = new Card("Spades", 4);
public void SortByValue() {
cards.Sort(new CardComparer_byValue(mycard));
} 

- , , ?

+3
3

, "".

Compare :

public int Compare(Card x, Card y)

"Card x" "Card y", cards, . Sort Compare, .

+5

, IComparer<T>, Compare(T x, T y), Sort .

Sort List<T>, , . List<T> Array.Sort, QuickSort .

+1
new CardComparer_byValue(mycard));

- . , Card, .

, IComparer - . , . ( " , , , - , , ." )

, - , :

  if (cmp.Compare(lhsCard, rhsCard) > 0)
       /* swap lhsCard & rhsCard */
0

Source: https://habr.com/ru/post/1757022/