Beispiel #1
0
        private void WriteXmlNodes(XmlWriter writer, IHierarchy <object> node)
        {
            if (node.HasXmlIgnoreAttribute())
            {
                return;
            }

            var writerMethod    = node.InstanceType.GetMethod(XmlWriterMethod, ReflectionUtility.BindingInstancePublicAndPrivate);
            var useWriterMethod = (writerMethod != null) && node.InstanceType.HasInterfaces(typeof(IXmlSerializable));

            if (useWriterMethod)
            {
                writerMethod.Invoke(node.Instance, new object[] { writer });
            }
            else
            {
                Condition.FlipFlop(node.HasChildren, WriteXmlChildren, WriteXmlValue, writer, node);
            }
        }