I have a small card game I'm making and the foreach loop throws an error on the last iteration in the collection. I assumed it was to do with the memory addressing so added the handTemp list to be iterated through instead. Still throws the same error though, can anybody help? thanks.
List<Card> handTemp = new List<Card>();
handTemp = players[0].hand;
foreach (Card c in handTemp)
{
if (c.strName == crd.strName)
{
players[0].hand.Remove(c);
pile.Add(c);
}
}