Ejemplo n.º 1
0
        private static object ContentToDictionary(DataNode dataNode)
        {
            if (dataNode.Nodes.Count == 0)
            {
                return(dataNode.Content);
            }
            if (dataNode.IsList)
            {
                List <object> list = new List <object>();
                for (int i = 0; i < dataNode.Nodes.Count; i++)
                {
                    DataNode dataNode2 = dataNode.Nodes[i];
                    list.Add(DataNodeDictionary.ContentToDictionary(dataNode2));
                }
                return(list);
            }
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            for (int j = 0; j < dataNode.Nodes.Count; j++)
            {
                DataNode dataNode3 = dataNode.Nodes[j];
                dictionary[dataNode3.Name] = DataNodeDictionary.ContentToDictionary(dataNode3);
            }
            return(dictionary);
        }
Ejemplo n.º 2
0
 public static IDictionary <string, object> ToDictionary(DataNode dataNode)
 {
     return(DataNodeDictionary.ContentToDictionary(dataNode) as IDictionary <string, object>);
 }