Is this code wrong? It's just not returning anything:
public IEnumerable<string> GetMethodsOfReturnType(Type cls, Type ret)
{
var methods = cls.GetMethods(BindingFlags.NonPublic);
var retMethods = methods.Where(m => m.ReturnType.IsSubclassOf(ret))
.Select(m => m.Name);
return retMethods;
}
It's returning an empty enumerator.
Note: I'm calling it on a ASP.NET MVC Controller looking for ActionResults
GetMethodsOfReturnType(typeof(ProductsController), typeof(ActionResult));