Ejemplo n.º 1
0
        public static void Traverse(this IEnumerable target, TraverseCallback callback)
        {
            IEnumerator enumerator = target.GetEnumerator();

            enumerator.Reset();
            while (enumerator.MoveNext())
            {
                callback.DynamicInvoke(enumerator.Current);
            }
        }
 public object traverse(TraverseCallback callback, ref Dictionary <string, object> io, int depth = 0, bool fromRoot = false)
 {
     if (isRoot)
     {
         fromRoot = true;
     }
     callback(this, ref io, depth);
     depth++;
     for (int i = 0; i < children.Count; i++)
     {
         children[i].traverse(callback, ref io, depth, fromRoot);
     }
     return(null);
 }