SelectDeclarationsWithAttribute<TAttribute>(IQuery<ICompilation>, Func<TAttribute, bool>?, bool)
Selects all custom attributes of a given type in the current compilation. This generic overloads constructs the attribute and accepts an optional predicate to filter the attribute.
Declaration
public static IQuery<IDeclaration> SelectDeclarationsWithAttribute<TAttribute>(this IQuery<ICompilation> receiver, Func<TAttribute, bool>? predicate = null, bool includeDerivedTypes = true)Parameters
| Type | Name | Description |
|---|---|---|
| IQuery<ICompilation> | receiver | A query selecting the compilation. |
| Func<TAttribute, bool> | predicate | An optional predicate to filter attributes based on their constructed values. |
| bool | includeDerivedTypes | Whether to include attributes whose type derives from |
Returns
| Type | Description |
|---|---|
| IQuery<IDeclaration> | A query selecting declarations that have the specified attribute. |
Type Parameters
| Name | Description |
|---|---|
| TAttribute | The attribute type to search for. It must be a compile-time or run-time-or-compile-time type. |
SelectDeclarationsWithAttribute(IQuery<ICompilation>, Type, Func<IAttribute, bool>?, bool)
Selects all custom attributes of a given type in the current compilation. This overloads accepts an optional predicate to filter the attribute.
Declaration
public static IQuery<IDeclaration> SelectDeclarationsWithAttribute(this IQuery<ICompilation> receiver, Type attributeType, Func<IAttribute, bool>? predicate = null, bool includeDerivedTypes = true)Parameters
| Type | Name | Description |
|---|---|---|
| IQuery<ICompilation> | receiver | A query selecting the compilation. |
| Type | attributeType | The attribute type to search for. |
| Func<IAttribute, bool> | predicate | An optional predicate to filter attributes based on their IAttribute representation. |
| bool | includeDerivedTypes | Whether to include attributes whose type derives from |
Returns
| Type | Description |
|---|---|
| IQuery<IDeclaration> | A query selecting declarations that have the specified attribute. |