public Card deal_one_card(List<Card> cards)
{
if (cards.Count() == 0)
{
return null;
}
return cards.RemoveAt(0);

    }


    I am getting an error when I run this function "Cannot implicitly convert type 'void' to 'Poker.Card'   

    Can somebody help with me this? 

    Thanks in advance.

RemoveAt has no return value (void is not a return value) but you try to return it in your last line. If you want to return and remove the first card, you'll need to place it in a temp variable, remove it from the list, then return the temp variable:

public Card deal_one_card(List<Cards> cards) {
    if (cards.Count() == 0) {
        return null;
    }

    Card result = cards[0];
    cards.RemoveAt(0);
    return result;
}

public Card deal_one_card(List<Cards> cards) {
if (cards.Count() == 0) {
return null;
}

    Card result = cards[0];
    cards.RemoveAt(0);
    return result;
}

I do not like the new code method.

You just need to indent by at least four spaces, or hit tab. Also be sure to leave a blank line above and below your code snippet. The preview shows you what it will look like. Sorry to hijack your thread!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.