private static void SaveFile() { var root = new XElement("InfoClientsDiscountsData"); foreach (var checkTicketTmp in InfoClientsDiscounts) { root.Add(InfoClientsDiscountsTypeType.ToXElement(checkTicketTmp)); } File.WriteAllText(Path, new XDocument(root).ToString()); }
private static void LoadFile() { if (File.Exists(Path)) { var document = XDocument.Load(Path); InfoClientsDiscounts.Clear(); foreach (var element in document.GetXElements("InfoClientsDiscountsData", "rec")) { InfoClientsDiscounts.Add(InfoClientsDiscountsTypeType.FromXElement(element)); } } }