UnityEditor.TreeViewTest.BackendData.GetParentsBelowStackBased C# (CSharp) Method

GetParentsBelowStackBased() private method

private GetParentsBelowStackBased ( System.Foo searchFromThis ) : HashSet
searchFromThis System.Foo
return HashSet
            private HashSet<int> GetParentsBelowStackBased(Foo searchFromThis)
            {
                Stack<Foo> stack = new Stack<Foo>();
                stack.Push(searchFromThis);
                HashSet<int> set = new HashSet<int>();
                while (stack.Count > 0)
                {
                    Foo foo = stack.Pop();
                    if (foo.hasChildren)
                    {
                        set.Add(foo.id);
                        foreach (Foo foo2 in foo.children)
                        {
                            stack.Push(foo2);
                        }
                    }
                }
                return set;
            }