enum E_Color { red, black };
private E_Color Color
{
get { return Color; }
set { Color = value; }
}
public Card(int color, int num)
{
Color = (E_Color)color;
There is no problem with your enum here. The problem is in your property. You are returning the property itself, which causes an infinite loop (Stackoverflow
).
Change it to this:
private E_Color Color
{
get; set;
}
What you are basically doing is this:
private E_Color GetColor()
{
return GetColor();
}