It's dangerous to code alone! Take this.

The Card

The following is one possible solution to this challenge.

using System;

Color[] colors = new Color[] { Color.Red, Color.Green, Color.Blue, Color.Yellow };
Rank[] ranks= new Rank[] { Rank.One, Rank.Two, Rank.Three, Rank.Four, Rank.Five, Rank.Six, Rank.Seven, Rank.Eight, Rank.Nine, Rank.Ten, Rank.DollarSign, Rank.Percent, Rank.Caret, Rank.Ampersand };

foreach (Color color in colors)
{
    foreach (Rank rank in ranks)
    {
        Card card = new Card(rank, color);
        Console.WriteLine($"The {card.Color} {card.Rank}");
    }
}



public class Card
{
    public Rank Rank { get; }
    public Color Color { get; }

    public Card(Rank rank, Color color)
    {
        Rank = rank;
        Color = color;
    }

    public bool IsSymbol => Rank == Rank.Ampersand || Rank == Rank.Caret || Rank == Rank.DollarSign || Rank == Rank.Percent;
    public bool IsNumber => !IsSymbol;
}

public enum Color { Red, Green, Blue, Yellow }
public enum Rank { One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, DollarSign, Percent, Caret, Ampersand }

Answer this question: Why do you think we used a color enumeration here but made a color class in the previous challenge?

“Because RB said to.”

Okay, a better answer.

Color seems like the right name for both of these concepts, but the needs are different. In the previous challenge, where we needed enough information to represent literally millions of colors with different R, G, and B values, we clearly need something more than an enumeration.

But could we have reused the Color class we made in the previous challenge for our enumeration here? Yeah, it could have been done. But it does drag along a lot of extra stuff unnecessarily. In the context of a card, the color is really just a game mechanic that needs to differentiate four suits/colors from each other. They just need unique names/values. The full Color class is overkill and would result in more complicated code all around. So using an enumeration here makes a lot of sense to keep the code simpler and more manageable.