私はC#winFormでアプリを作成しており、ListViewを使用してデータを保存しています。フォームを閉じたときにこのアイテムのリストを保存し、フォームを再度開いたときに再度ロードする必要があります。
これは、リストに新しい要素を追加するためのコードです。
string[] timeitem = new string[2];
timeitem[0] = txtDescription.Text;
timeitem[1] = msktime.Text;
ListViewItem lvi = new ListViewItem(timeitem);
lstTimes.Items.Add(lvi);
このリストを保存してロードするための最良の方法は何ですか?ユーザーのダイアログは必要ありません。ユーザーがListViewアイテムを含むフォームを開くたびに、このリストが自動的に保存およびロードされる必要があります。私は.txtまたはxmlファイルのいずれかを使用することができます。