Beispiel #1
0
 /// <summary>
 /// Visits the children of the given node.
 /// </summary>
 /// <param name="node">The node being visited.</param>
 protected virtual void VisitChildren([NotNull] IObjectNode node)
 {
     if (node == null)
     {
         throw new ArgumentNullException(nameof(node));
     }
     foreach (var child in node.Members)
     {
         CurrentPath.PushMember(child.Name);
         VisitNode(child);
         CurrentPath.Pop();
     }
 }
Beispiel #2
0
        /// <summary>
        /// Visits the children of the given node.
        /// </summary>
        /// <param name="node">The node being visited.</param>
        protected virtual void VisitChildren([NotNull] IObjectNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException(nameof(node));
            }
            var members = node.Members;

            if (members is List <IMemberNode> asList)
            {
                foreach (var child in asList)
                {
                    CurrentPath.PushMember(child.Name);
                    VisitNode(child);
                    CurrentPath.Pop();
                }
            }
            else if (members is Dictionary <string, IMemberNode> .ValueCollection asVCol)
            {
                foreach (var child in asVCol)
                {
                    CurrentPath.PushMember(child.Name);
                    VisitNode(child);
                    CurrentPath.Pop();
                }
            }
            else
            {
                foreach (var child in members)
                {
                    CurrentPath.PushMember(child.Name);
                    VisitNode(child);
                    CurrentPath.Pop();
                }
            }
        }