title: Elegant technique to move items from one array to another
body: <p>Context:  A card game; I want to deal out cards from a deck to each player in the game, in a clean way.</p>
  
  <p>This is what I had in mind:</p>
  
  <pre><code>public static CardGame.IGame DealAll(this CardGame.IGame objThis, CardGame.Card[] cards)
      {
          if (objThis.Players.Length &gt; 0)
          {
              for (int i = 0; i &lt; cards.Length; i++)
              {
                  objThis.Deck.MoveTo(cards[i], objThis.CurrentPlayer.Hand);
  
                  objThis.AdvancePlayer();
              }
          }
  
          return objThis;
      }
  
  public static Card[] MoveTo(this Card[] objThis, Card card, Card[] cards)
      {
          List&lt;Card&gt; lstCards = cards.ToList();
          List&lt;Card&gt; lstThis = objThis.ToList();
  
          lstThis.Remove(card);
          lstCards.Add(card);
  
          objThis = lstThis.ToArray();
          cards = lstCards.ToArray();
  
          return cards;
      }
  </code></pre>
  
  <p>Surely you can see the reference problems.  Using the ref keyword leads to some not-so-nice looking code, but it may be unavoidable.  Any suggestions?</p>
  
  <p>I would prefer a solution that is flexible enough to handle other "card-passing" situations (a player playing a card to the pile, moving cards from the pile to a "trash" deck, etc.).</p>