private static void SaveFile() { var document = new XDocument(new XElement("ProDiscounts")); foreach (var proDiscount in ProDiscounts) { document.GetXElement("ProDiscounts").Add(ProDiscount.ToXElement(proDiscount)); } document.Save(Path); }
private static void LoadFile() { if (File.Exists(Path)) { var document = XDocument.Load(Path); ProDiscounts.Clear(); foreach (var element in document.GetXElements("ProDiscounts", "rec")) { ProDiscounts.Add(ProDiscount.FromXElement(element)); } } }