title: Trying to remove a card from a deck BlackJack getting IndexOutOfRange exception
body: <p>I am creating a little BlackJack application in C#. I am able to deal an intial hand to both the dealer and the player and then hit for the player. However once I do this, the dealer is supposed to draw a card from the deck when the dealer handvalue is less than 17.</p>
  
  <p>This is the get a single card from the deck in the deck class:</p>
  
  <pre><code>public Card GetCard()
  {
      int r0 = rndCard.Next(0, cardsInDeck_.Count - 1);
      cardsInDeck_.RemoveAt(r0);
      return cardsInDeck_[r0];
  }
  </code></pre>
  
  <p>when I hit "stay" and the dealer activates I get this error on the last line</p>
  
  <p><code>Index was out of range. Must be non-negative and less than the size of the collection</code></p>
  
  <p>This is my "stay" method on the form</p>
  
  <pre><code> private void buttonStay_Click(object sender, EventArgs e)        
   {          
      while (dealer.GetValue() &lt; 17) 
      {
          dealer.CardsInDealerHand.Add(deck.GetCard());
  
      }
  
      dealerHandValue_ = dealer.GetValue();
  
      if (dealerHandValue_ &gt; 21)
      {
          Win();
  
      }
      else
      {
          WinCondition();
      }
   }
  </code></pre>
  
  <p>I am new to programming in general but I think that something is wrong with either my deck or dealer.</p>
  
  <p>I would appreciate any help on this.</p>