title: Keeping track of cards in a storage piles in C# with out a database
body: <p>I have a card game that I am developing and in the said game you can have up to 4 storage piles. the way it works is to end your turn you play a card to said storage pile:</p>
  
  <pre><code>namespace Shikana.Game.Logic.Players.StoragePiles
  {
      public enum Piles
      {
          PileA = 1,
          PileB = 2,
          PileC = 3,
          PileD = 4
      }
  }
  </code></pre>
  
  <p>My goal is, without the use of a database (including SQLite), to keep track of the order of cards in each storage pile for a player, throughout the whole game (start to finish). The player class or at least the parts you need to care about for this question is below:</p>
  
  <pre><code>namespace Shikana.Game.Logic.Players
  {
      public class Player
      {
          public void playersHand(List&lt;Card&gt; cards)
          {
              this.Hand = cards;
          }
  
         /// ...
  
          public void storeCard(Card card, Piles pile)
          {
              Storage cardPile = new Storage(card, pile);
  
              List&lt;Storage&gt; storage = new List&lt;Storage&gt;();
              storage.Add(cardPile);
              this.StoragePiles = storage;
          }
  
          public List&lt;Card&gt; Hand { get; private set; }
  
          public List&lt;Storage&gt; StoragePiles { get; private set; }
      }
  }
  </code></pre>
  
  <p>Here we just store a card into a list, via the <code>storeCard()</code> method, which takes a Card obj and a Pile from the enum of <code>Piles</code>:</p>
  
  <pre><code>namespace Shikana.Game.Logic.Players.StoragePiles
  {
      public class Storage
      {
          public Storage(Card card, Piles pile)
          {
              this.Card = card;
              this.Pile = pile;
          }
  
          public bool validatePile(Piles pile)
          {
              return Enum.IsDefined(typeof(Piles), pile);
          }
  
  
          public Card Card { get; private set; }
  
          public Piles Pile { get; private set; }
      }
  }
  </code></pre>
  
  <p>With all that said the end result of storing multiple cards will be:</p>
  
  <pre><code>&lt;(Card, PileA), (Card, PileB), (Card, PileC), ...&gt;
  </code></pre>
  
  <p>I need to re-write the <code>Storage</code> class to add to a list or create said the list of cards for a specific pile the player wants to store a card in when they end their turn. A player can ONLY have 4 storage piles and can ONLY store one card per turn.</p>
  
  <p>The list must be ordered where the card placed in storage, at the end of said turn, is placed at the bottom. A player must play bottom-up from that list of cards for that said pile.</p>
  
  <p>The question is:</p>
  
  <p><strong>How do I re-write the storage class to store cards for a specific pile and be able to update said pile when the player chooses to end his turn by playing a card to the storage pile?</strong></p>
  
  <p><em>Everything I think of leads me back to create databases including player objects, play pile objects, and relationships to cards. But again I want NOTHING to do with a database and should be able to store this information in the player object somehow.</em></p>