Represents query of declarations to which aspects, validators, diagnostics and code fix suggestions can be added. This interface exposes LINQ-like methods that can be combined in complex queries.
Namespace: Metalama.Framework.Fabrics
Assembly: Metalama.Framework.dll
Syntax
public interface IQuery<out TDeclaration> : IQuery where TDeclaration : class, IDeclarationType Parameters
| Name | Description |
|---|---|
| TDeclaration | The type of declarations in the current set. |
Methods
| Name | Description |
|---|---|
| OfType<TOut>() | Selects all declarations of a given type. |
| SelectMany<TMember>(Func<TDeclaration, IEnumerable<TMember>>) | Projects each declaration of the current set to an IEnumerable<T> (typically a list of child declarations) and flattens the resulting sequences into one set. |
| SelectTypes(bool) | Selects all types enclosed in declarations of the current set. |
| SelectTypesDerivedFrom(INamedType, DerivedTypesOptions) | Selects all types, among those enclosed in declarations of the current set, that derive from or implement a given INamedType. |
| SelectTypesDerivedFrom(Type, DerivedTypesOptions) | Selects all types, among those enclosed in declarations of the current set, that derive from or implement a given Type. |
| Select<TMember>(Func<TDeclaration, TMember>) | Projects each declaration of the current set into a new declaration. |
| Tag<TTag>(Func<TDeclaration, TTag>) | |
| ToCollection(ICompilation?) | Evaluates the current query into a collection. This method should only be used for debugging or testing purposes. |
| Where(Func<TDeclaration, bool>) | Filters the set of declarations based on a predicate. |
| WithTag<TTag>(Func<TDeclaration, TTag>) | Projects the declarations in the current set by adding a tag for each declaration, and returns a ITaggedQuery<TDeclaration, TTag>. Methods of this interface have overloads that accept this tag. |