private void OnWindowClosing(object sender, CancelEventArgs e) { List <GameSaveFileInfo> gameSaveFiles = new List <GameSaveFileInfo>(); foreach (object listViewItem in gameSaves) { gameSaveFiles.Add(((ListViewItem)listViewItem).Tag as GameSaveFileInfo); } PokeManager.SetGameSaveFileInfoList(gameSaveFiles.ToArray()); }