public void Add(Expando p)
 {
     foreach (ExpandoMember m in p.GetFields())
     {
         Add(m.Name);
     }
 }
Example #2
0
        void SerializeTo(IXMLDocument doc, IXMLElement r, Expando x)
        {
            ExpandoMember[] c = x.GetFields();

            foreach (ExpandoMember m in c)
            {
                IXMLElement n = new IXMLElement(doc, m.Name);

                if (m.Self.IsString || (m.Self.IsNumber))
                {
                    n.appendChild(new ITextNode(doc, m.Value));
                }
                else
                {
                    if (m.Self.IsBoolean)
                    {
                        n.appendChild(new ITextNode(doc, m.Value));
                    }
                    else if (m.Self.IsArray)
                    {
                        Expando[] a = m.Self.To <Expando[]>();

                        foreach (Expando i in a)
                        {
                            IXMLElement an = new IXMLElement(doc, i.TypeMetaName);

                            SerializeTo(doc, an, i);

                            n.appendChild(an);
                        }
                    }
                    else if (m.Self.IsObject && (!m.Self.IsNull))
                    {
                        SerializeTo(doc, n, m.Self);
                    }
                }

                r.appendChild(n);
            }
        }