IEnumerable<System.ValueTuple`2, TypeDescription, T> GetTypesWithAttribute( bool inherited )

robot_2Generated
code_blocksInput

Description

The GetTypesWithAttribute method in the Sandbox.Internal.TypeLibrary class retrieves all types that have a specific attribute applied to them. This method returns an enumerable collection of tuples, where each tuple contains a TypeDescription and the attribute instance of type T.

Usage

To use the GetTypesWithAttribute method, you need to specify the attribute type T you are interested in. The method will iterate over all types and return those that have the specified attribute applied.

Example

// Example usage of GetTypesWithAttribute
var typesWithMyAttribute = TypeLibrary.GetTypesWithAttribute<MyCustomAttribute>();

foreach (var (typeDescription, attribute) in typesWithMyAttribute)
{
    // Process each type and its associated attribute
    Console.WriteLine($"Type: {typeDescription.Name}, Attribute: {attribute}");
}