IEnumerable<System.ValueTuple`2, MethodDescription, T> GetMethodsWithAttribute( bool onlyStatic )

robot_2Generated
code_blocksInput

Description

The GetMethodsWithAttribute method in the Sandbox.Internal.TypeLibrary class retrieves a collection of methods that have a specific attribute applied to them. This method returns an enumerable collection of tuples, where each tuple contains a MethodDescription and the attribute of type T that is applied to the method.

Usage

To use the GetMethodsWithAttribute method, you need to specify the type of attribute you are interested in. The method will return all methods that have this attribute applied. This is useful for reflection-based operations where you need to dynamically discover methods with specific attributes.

Example

// Example usage of GetMethodsWithAttribute
var methodsWithAttribute = typeLibraryInstance.GetMethodsWithAttribute<MyCustomAttribute>();

foreach (var (methodDescription, attribute) in methodsWithAttribute)
{
    // Access method description
    Console.WriteLine($"Method: {methodDescription.Name}");
    
    // Access the attribute
    Console.WriteLine($"Attribute: {attribute.GetType().Name}");
}