public static string ToXml(CGItemCollection cgItems) { XElement root = cgItems.ToXElement(CGItemsTagName); StringWriter writer = new StringWriter(); root.Save(writer); return(writer.ToString()); }
public CGItemCollection Clone() { var result = new CGItemCollection(); foreach (var item in this) { result.Add(item.Clone()); } return(result); //throw new NotImplementedException(); }
public static CGItemCollection FromXElement(XElement element) { CGItemCollection items = new CGItemCollection(); foreach (var child in element.Elements()) { var temp = Type.GetType(child.Attribute("type").Value); try { CGItem item = (CGItem)Activator.CreateInstance(temp); item.Init(child /*element*/); items.Add(item); } catch { } } return(items); //throw new NotImplementedException(); }