public void AddCard(string iCollectionName, string iCardName, double iCardPrice, bool iInDeck) { //This adds card to a collection. CardCollection newCard = new CardCollection(); List <CardCollection> collList = new List <CardCollection>(); //the PopulateCardList method fills the list with all the card before the one being added. newCard.PopulateCardList(collList, iCollectionName); newCard.CollectionName = iCollectionName; newCard.CardName = iCardName; newCard.CardPrice = iCardPrice; newCard.InDeck = iInDeck; collList.Add(newCard); XmlSerializer xs = new XmlSerializer(typeof(List <CardCollection>)); File.Delete(iCollectionName); using (FileStream fs = new FileStream(@"collections\" + iCollectionName, FileMode.Create)) { xs.Serialize(fs, collList); } MessageBox.Show("card added here: " + @"collections\" + iCollectionName); }