Skip to content
Discussion options

You must be logged in to vote

You can easily exchange this with IRenderedComponent<IComponent>:

internal static IEnumerable<IElement> FindLabelsContainingText(this IRenderedComponent<IComponent> renderedFragment, string text)
{
    var labels = renderedFragment.FindAll("label");
    return labels.Where(x => x.TextContent.Contains(text));
}

Edit: The interface is covariant: IRenderedComponent<out IComponent> - therefore it automatically works automatically for every component. As you don't need the type itself, you don't need TComponent here.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by madhon
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants