I have a marker interface something like this:
[AttributeUsage(AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public class MyAttribute : Attribute
{
}
And i want to apply it to methods on different classes in different assemblies…
Then I want to Get a MethodInfo for all methods that have this attribute applied. I need to search the whole AppDomain and get a reference to all these methods.
I know we can get all types and then get all methods, but is there a quicker/better way to do this? … or is this the quickest manner to get the information I need?
(I’m using ASP.NET MVC 1.0, C#, ./NET 3.5)
Thanks heaps!
Ultimately, no – you have to scan them. LINQ makes it fairly pain-free though.
Note this only scans loaded assemblies “as is”.