小编Bry*_*nte的帖子

获取List <x,y>的所有元素值

我是新来的,我想帮一些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)

.net c# loops list

1
推荐指数
1
解决办法
124
查看次数

标签 统计

.net ×1

c# ×1

list ×1

loops ×1