Example #1
0
        public XElement WriteObject(IEnumerable <Element> value)
        {
            XmlElementSerializer   elementSerializer = new XmlElementSerializer();
            IEnumerable <XElement> elements          = value.Select(elementSerializer.WriteObject);

            return(new XElement(ELEMENT_ELEMENTS, elements));
        }
Example #2
0
        public IEnumerable <Element> ReadObject(XElement element)
        {
            List <Element> elements = new List <Element>();

            XElement parentNode = element.Element(ELEMENT_ELEMENTS);

            if (parentNode != null)
            {
                XmlElementSerializer elementSerializer = new XmlElementSerializer();
                elements.AddRange(parentNode.Elements().Select(elementSerializer.ReadObject).NotNull());
            }

            return(elements);
        }