Example #1
0
        /// <summary>
        /// Convert to a dictionary, this can be a lossy process if multiple nodes with the same value exist
        /// </summary>
        /// <returns>The key as a dictionary</returns>
        public IDictionary ToDictionary()
        {
            Dictionary <string, object> dict = new Dictionary <string, object>();

            foreach (DataNode node in _subNodes)
            {
                DataKey key = node as DataKey;

                if (key != null)
                {
                    dict[node.Name] = key.ToDictionary();
                }
                else
                {
                    dict[node.Name] = ((DataValue)node).Value;
                }
            }

            return(dict);
        }