Esempio n. 1
0
        public void Add(NameObjectCollection c)
        {
            if (c == null)
            {
                throw new ArgumentNullException("c");
            }
            this.InvalidateCachedArrays();
            int count = c.Count;

            for (int i = 0; i < count; i++)
            {
                string   key    = c.GetKey(i);
                object[] values = c.GetValues(i);
                if (values != null)
                {
                    for (int j = 0; j < values.Length; j++)
                    {
                        this.Add(key, values[j]);
                    }
                }
                else
                {
                    this.Add(key, null);
                }
            }
        }
Esempio n. 2
0
 private static void WriteXML(NameObjectCollection xmlCol, ref List <string> xmlList)
 {
     if (xmlCol != null && xmlCol.Count > 0)
     {
         int count = xmlCol.Count;
         for (int i = 0; i < count; i++)
         {
             string   key    = xmlCol.GetKey(i);
             object[] values = xmlCol.GetValues(i);
             if (values != null)
             {
                 for (int j = 0; j < values.Length; j++)
                 {
                     object obj = values[j];
                     if (obj != null)
                     {
                         if (obj is NameObjectCollection)
                         {
                             xmlList.Add(string.Format("<{0}>", key));
                             WriteXML((NameObjectCollection)obj, ref xmlList);
                             xmlList.Add(string.Format("</{0}>", key));
                         }
                         else
                         {
                             xmlList.Add(string.Format("<{0}>{1}</{0}>", key, obj));
                         }
                     }
                     else
                     {
                         xmlList.Add(string.Format("<{0} />", key));
                     }
                 }
             }
         }
     }
 }