I can't figure out why I'm getting this error, I spend like an hour looking at this code and nothing comes to my mind. " System.ArgumentOutOfRangeException: 'Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')' "
private void SetUpGame()
{
List<string> animalEmoji = new List<string>()
{
"", "",
"", "",
"", "",
"", "",
"", "",
"","",
"","",
"","",
};
Random random = new Random();
foreach (TextBlock textBlock in mainGrid.Children.OfType<TextBlock>())
{
int index = random.Next(animalEmoji.Count);
string nextEmoji = animalEmoji[index];
textBlock.Text = nextEmoji;
animalEmoji.RemoveAt(index);
}
}