Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing Descendants<T> api #387

Merged
merged 2 commits into from
Jan 21, 2020
Merged

Conversation

MihaZupan
Copy link
Collaborator

We were missing a few conveniance overloads (#63)

IEnumerable<T> Descendants<T>(this MarkdownObject) where T : Inline
IEnumerable<T> Descendants<T>(this MarkdownObject) where T : Block

Since these can't coexist in C#, I added one where T : MarkdownObject that then calls the appropriate internal overload for optimal traversal (has the added bonus of not allocating when it's obvious there can't be any descendants).

Added tests for all the different overloads to make sure the traversal logic is correct.

@xoofx xoofx merged commit 7875e4b into xoofx:master Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants