C# 没有暗指';卡片';从'转换;卡片';不可比

C# 没有暗指';卡片';从'转换;卡片';不可比,c#,icomparable,C#,Icomparable,如何比较卡片列表?我得到了这个错误,我不知道它意味着什么,也不知道如何修复它。我得到的错误是: 类型“Card”不能用作泛型类型或方法“secondClass”中的类型参数“T”。不存在从“Card”到“IComparable”的“Card”转换的隐式引用 类节点 { 公共int id; 公共数据; 公共节点下一步; } 类GameLinkedList,其中T:IComparable { 专用节点头; 专用节点温度; 私有整数计数=0; 公共无效地址(T) { 计数++; 温度=水头; 节点=新

如何比较卡片列表?我得到了这个错误,我不知道它意味着什么,也不知道如何修复它。我得到的错误是:

类型“Card”不能用作泛型类型或方法“secondClass”中的类型参数“T”。不存在从“Card”到“IComparable”的“Card”转换的隐式引用

类节点
{
公共int id;
公共数据;
公共节点下一步;
}
类GameLinkedList,其中T:IComparable
{
专用节点头;
专用节点温度;
私有整数计数=0;
公共无效地址(T)
{
计数++;
温度=水头;
节点=新节点();
node.data=t;
node.id=计数;
node.next=temp;
头部=节点;
}
}
类束
{
//私人名单1;
GameLinkedList组=新建GameLinkedList();
}
班级卡
{     
私人诉讼;
私人价值;
私有字符串cardName;
}

您的
类需要实现
IComparable
接口


要么在卡上实现IComparable(根据下面@MarcoFatica的回答),要么删除该要求(即删除
,其中T:IComparable
)。
class Node<T>
{
    public int id;
    public T data;
    public Node<T> next;
}

class GameLinkedList<T> where T : IComparable
{
    private Node<T> head;
    private Node<T> temp;
    private int count = 0;

    public void AddFront(T t)
    {
        count++;
        temp = head;
        Node<T> node = new Node<T>();
        node.data = t;
        node.id = count;
        node.next = temp;
        head = node;
    }
}

class Bundle
{
    //private List<Card> deck1;
    GameLinkedList<Card> deck = new GameLinkedList<Card>();
}

class Card
{     
    private Suit suit;
    private Value value;
    private string cardName;
}