示例#1
0
        public XElement WriteObject(IEnumerable <IOutputDevice> value)
        {
            XmlControllerSerializer controllerSerializer = new XmlControllerSerializer();
            IEnumerable <XElement>  elements             = value.Select(controllerSerializer.WriteObject);

            return(new XElement(ELEMENT_CONTROLLERS, elements));
        }
示例#2
0
        public IEnumerable <IOutputDevice> ReadObject(XElement element)
        {
            List <IOutputDevice> controllers = new List <IOutputDevice>();

            XElement parentNode = element.Element(ELEMENT_CONTROLLERS);

            if (parentNode != null)
            {
                XmlControllerSerializer controllerSerializer = new XmlControllerSerializer();
                controllers.AddRange(parentNode.Elements().Select(controllerSerializer.ReadObject).NotNull());
            }

            return(controllers);
        }