/// <summary> /// DescendantsAndSelf iterator /// </summary> /// <param name="source"></param> /// <returns></returns> private static IEnumerable <TokenSequence> DescendantsAndSelfIterator(TokenSequence source) { // and self yield return(source); foreach (TokenSequence descendant in ModelSubsequencer.DescendantsIterator(source)) { yield return(descendant); } }
/// <summary> /// Gets all descendant values below the current root /// </summary> /// <param name="source"></param> /// <returns></returns> public static IEnumerable <TokenSequence> Descendants(this TokenSequence source) { if (source == null) { throw new ArgumentNullException("source"); } if (!(source is IList <ModelToken>)) { // ensure buffered source = new SequenceBuffer <ModelToken>(source); } return(ModelSubsequencer.DescendantsIterator(source)); }