GetDeclarationsWithAttribute<TAttribute>(ICompilation, Func<TAttribute, bool>?, bool)
Gets all declarations in the compilation that are annotated with a specific attribute type.
Declaration
public static IEnumerable<IDeclaration> GetDeclarationsWithAttribute<TAttribute>(this ICompilation compilation, Func<TAttribute, bool>? predicate = null, bool includeDerivedTypes = true)Parameters
| Type | Name | Description |
|---|---|---|
| ICompilation | compilation | The compilation to search. |
| 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 |
|---|---|
| IEnumerable<IDeclaration> | An enumerable of declarations that have the specified attribute. |
Type Parameters
| Name | Description |
|---|---|
| TAttribute | The attribute type to search for. Must be a compile-time or run-time-or-compile-time type. |
GetDeclarationsWithAttribute(ICompilation, Type, Func<IAttribute, bool>?, bool)
Gets all declarations in the compilation that are annotated with a specific attribute type, specified as a reflection Type.
Declaration
public static IEnumerable<IDeclaration> GetDeclarationsWithAttribute(this ICompilation compilation, Type attributeType, Func<IAttribute, bool>? predicate = null, bool includeDerivedTypes = true)Parameters
| Type | Name | Description |
|---|---|---|
| ICompilation | compilation | The compilation to search. |
| 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 |
|---|---|
| IEnumerable<IDeclaration> | An enumerable of declarations that have the specified attribute. |