text: public static IList<ITree> GetAncestors(ITree t){if (t.Parent == null){return Collections.EmptyList<ITree>();}IList<ITree> ancestors = new List<ITree>();t = t.Parent;while (t != null){ancestors.Insert(0, t);t = t.Parent;}return ancestors;}