我正在使用Sam Jenkin 的 Deck of Cards 课程。我正在尝试查询西装中的某些卡片。我收到错误:
无法将类型“System.Collections.Generic.IEnumerable”隐式转换为“System.Collections.Generic.IEnumerable”。存在显式转换(您是否缺少演员表?)
我试过移动东西,但我不理解错误。有人可以帮忙吗?我的代码是:
var deck = new Deck();
IEnumerable<Deck> deckQuery =
from myCard in deck.Cards
where myCard.Suit == Suit.Club
select myCard.CardNumber;
我的Card
课是:
public class Card : ICard
{
public Suit Suit { get; set; }
public CardNumber CardNumber { get; set; }
}
我的枚举数是:
public enum Suit
{
Club = 1,
Diamond = 2,
Heart = 3,
Spades = 4,
}
public enum CardNumber
{
Ace = 1,
Two = 2,
Three = 3,
Four = 4,
Five = 5,
Six = 6,
Seven = 7,
Eight = 8,
Nine = 9,
Ten = 10,
Jack = 11,
Queen = 12,
King = 13,
}