FECipherVit.SelectHero.CardListRenew C# (CSharp) Method

CardListRenew() private method

private CardListRenew ( ) : void
return void
        private void CardListRenew()
        {
            int index_old = CardListBox.SelectedIndex;
            CardListBox.Items.Clear();
            foreach (Card card in Player.Deck.CardList)
            {
                string temp = "";
                temp += card.CardName;
                CardListBox.Items.Add(temp);
            }
            if (index_old < 0)
            {
                CardListBox.SelectedIndex = 0;
            }
            else if (index_old >= CardListBox.Items.Count)
            {
                CardListBox.SelectedIndex = CardListBox.Items.Count - 1;
            }
        }