I'm pretty new at c# coding and I'm having trouble displaying my cards shuffled side by side, and I'm not sure if I coded the cards and deck correctly in the first place. Anything is helpful including tips!
My Enums
public enum SuitEnum
{
Hearts,
Diamonds,
Clubs,
Spades
}
public enum ValueEnum
{
Ace = 1,
Two = 2,
Three = 3,
Four = 4,
Five = 5,
Six = 6,
Seven = 7,
Eight = 8,
Nine = 9,
Ten = 10,
Jack = 10,
Queen = 10,
King = 10
}
The Card class
public class Card
{
SuitEnum Suit { get; set; }
ValueEnum Value { get; set; }
public Card(SuitEnum cardSuit, ValueEnum cardValue)
{
Suit = cardSuit;
Value = cardValue;
}
}
And finally my Deck class
public class Deck
{
public List<Card> Cards { get; set; }
public Deck()
{
Cards = new List<Card>();
foreach (SuitEnum suit in Enum.GetValues(typeof(SuitEnum)))
{
foreach (ValueEnum value in Enum.GetValues(typeof(ValueEnum)))
{
Cards.Add(new Card(suit, value));
}
}
}
So now that I have my cards and deck coded how would I display all 52 cards in my main program code shuffled each time? Would I have to make another method in a class? Or perhaps just make a loop in my main code? Let me know what you think.