1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
private void button1_Click(object sender, EventArgs e)
{
// On construit la liste des items à sérialiser
List<string> list = new List<string>();
foreach (string i in comboBox1.Items)
{
list.Add(i);
}
// On sérialise cette liste
this.Serialize(list);
// On désérialise dans une nouvelle liste
//List<string> newList = this.Deserialize();
//if (newList != null)
//{
// // On ajoute à la ComboBox les éléments désérialisés
// this.comboBox1.Items.AddRange(newList.ToArray());
//}
} |