/// <summary> /// Method saves objects to xml file. /// </summary> /// <param name="path">Path to file<T>.</param> public void SaveToXmlFile(string path) { var collection = new List <T>(); IEnumerator item = Root.Tree.GetEnumerator(); while (item.MoveNext()) { collection.Add((T)item.Current); } XmlFileExtension <T> .SaveToFile(path, collection); }
/// <summary> /// Method get objects from xml file. /// </summary> /// <param name="path">Path to file<T>.</param> public void GetFromXmlFile(string path) { try { foreach (var item in XmlFileExtension <T> .GetFromFile(path)) { Add(item); } } catch (Exception) { throw new ArgumentException("The argument does not match the T collection"); } }