/// <summary> /// Returns a collection of the descendant tokens for this token in document order. /// </summary> /// <returns>An <see cref="IEnumerable{JToken}"/> containing the descendant tokens of the <see cref="JToken"/>.</returns> public IEnumerable <JToken> Descendants() { foreach (JToken o in ChildrenTokens) { yield return(o); JContainer c = o as JContainer; if (c != null) { foreach (JToken d in c.Descendants()) { yield return(d); } } } }
internal IEnumerable<JToken> GetDescendants(bool self) { if (self) { yield return this; } foreach (JToken o in ChildrenTokens) { yield return o; JContainer c = o as JContainer; if (c != null) { foreach (JToken d in c.Descendants()) { yield return d; } } } }