if(App.ActiveCellar == null) { MessageBox.Show("Aucune cave n'est ouverte"); return; } string bottleName = "75 cl"; ObjectCollection bottles = App.ActiveCellar.GetCollection((ushort)ObjectType.BottleType); BaseItem ret = null; for (int i = 0; i < bottles.Count; i++) { BaseItem item = (BaseItem)bottles[i]; if(item.Name.Trim() == bottleName) { ret = item; break; } } if(ret == null) { MessageBox.Show("Bouteille \"" + bottleName + "\" introuvable.\nImpossible de continuer."); return; } ObjectCollection wines = App.ActiveCellar.GetCollection((ushort)ObjectType.Wine); for (int i = 0; i < wines.Count; i++) { Wine wine = (Wine)wines[i]; if(wine.BottleType.Name.Trim() == String.Empty) { wine.BottleType = (BottleType)ret; wine.Save(); } }