private IDictionary <string, object> GetOrCreateNode(DataPath path)
        {
            var current = root as IDictionary <string, object>;

            foreach (var node in path.Nodes.Take(path.Nodes.Length - 1))
            {
                if (current.ContainsKey(node))
                {
                    current = (IDictionary <string, object>)current[node];
                }
                else
                {
                    var next = new ExpandoObject();
                    current.Add(node, next);
                    current = next as IDictionary <string, object>;
                }
            }
            return(current);
        }
Exemplo n.º 2
0
 public object Get(DataPath path)
 {
     return(dictionary[path]);
 }
Exemplo n.º 3
0
 public void Add(DataPath path, object value)
 {
     dictionary.Add(path, value);
 }