如何比较卡片清单?我收到此错误,我不知道它是什么意思或如何解决它。我得到的错误:
类型'Card'不能用作泛型类型或方法'secondClass'中的类型参数'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;
}