I've had to search all loaded assemblies for methods or classes with certain custom attributes on them dozens of times when writing some generic framework for something or such... So I linqified it today, and came up with this:
public static List<MethodInfo>
GetMethodsWithAttribute(Type t, bool inherit)
return (from ass in AppDomain.CurrentDomain
from c in ass.GetExportedTypes()
from m in c.GetMethods()
from a in m.GetCustomAttributes(t, inherit)
This sample just prints out all methods with the SecurityPermission attribute. Notice my continued "abuse" of lambda as well...