コード例 #1
0
        public XElement WriteObject(IEnumerable <IOutputDevice> value)
        {
            XmlPreviewSerializer   previewSerializer = new XmlPreviewSerializer();
            IEnumerable <XElement> elements          = value.Select(previewSerializer.WriteObject);

            return(new XElement(ELEMENT_PREVIEWS, elements));
        }
コード例 #2
0
        public IEnumerable <IOutputDevice> ReadObject(XElement element)
        {
            List <IOutputDevice> previews = new List <IOutputDevice>();

            XElement parentNode = element.Element(ELEMENT_PREVIEWS);

            if (parentNode != null)
            {
                XmlPreviewSerializer previewSerializer = new XmlPreviewSerializer();
                previews.AddRange(parentNode.Elements().Select(previewSerializer.ReadObject).NotNull());
            }

            return(previews);
        }