[Beginner Question] – Where should I store my generic list objects?

Hi all, sorry to bother you again. I read through the Yellow Book, but am still doing something wrong. (I can understand it is wrong, but not sure how to fix in terms of design.)

I have a class, Races.cs, with an enum of Race {Human,Elf,Orc} and a secondary enum of AttackPower {Zero=0,One,Two,Three}

I want to make a Deck of all possibilities, and am currently attempting to store them in a Generic List within the same Races.cs class. This seems, wrong and would like suggestions

 public enum Race { Human, Elf, Orc } public enum AttackValue { Zero = 0, One, Two, Three, Four, Five } public class Card { private Race race; private AttackValue attack; public Race Race { get { return this.race; } private set { this.race = value; } } public AttackValue AttackValue { get { return this.attack; } private set { this.attack = value; } } public Card(){} public Card(Race Race, AttackValue AttackValue){} ~Card(){} List<Card> cards = new List<Card>(); // Ultimately, I want a method(?) to just call Initilize() on somewhere and return with all my objects. public void DeckMethod() { CardCollection(); } // Confusing myself here... public List<Card> CardCollection() { List<Card> listofCards = new List<Card>(); Race r = race; AttackValue av = attack; foreach (Race _race in Enum.GetValues(typeof(Race))) { r = _race; } foreach (AttackValue _attack in Enum.GetValues(typeof(AttackValue))) { av = _attack; } Card card = new Card(r, av); listofCards.Add(card); return listofCards; } } public class Deck { } 

by blackcamo via /r/csharp

Leave a Reply