我是新来的,我想帮一些List ...
实际上,我想将y我的每个元素添加List<x, y>到变量中.我知道,这可能很容易,但我被困在那一部分..
/// <summary>
/// Number of cards in the deck
/// </summary>
public byte NbTotalCards
{
get
{
byte nbCards = 0;
for (byte i = 0; i <= this.LstCardsWithQt.Count; i++)
{
if (this.LstCardsWithQt[i].Qt != 0)
{
if(this.LstCardsWithQt[i].Qt.Equals(2))
nbCards += 2;
else
{
nbCards += 1;
}
}
else
{
nbCards += 0;
}
}
return nbCardss;
}
}
Run Code Online (Sandbox Code Playgroud)
哪里
public List<DeckEntry> LstCardsWithQt
和
public DeckEntry(Card card, byte qt)
{
this.Card = carte; …Run Code Online (Sandbox Code Playgroud)