public static IList<Tuple<RuleDependencyAttribute, ICustomAttributeProvider>> GetDependencies(Type clazz)
{
IList<Tuple<RuleDependencyAttribute, ICustomAttributeProvider>> result = new List<Tuple<RuleDependencyAttribute, ICustomAttributeProvider>>();
GetElementDependencies(AsCustomAttributeProvider(clazz), result);
foreach (ConstructorInfo ctor in clazz.GetConstructors(AllDeclaredMembers))
{
GetElementDependencies(AsCustomAttributeProvider(ctor), result);
foreach (ParameterInfo parameter in ctor.GetParameters())
GetElementDependencies(AsCustomAttributeProvider(parameter), result);
}
foreach (FieldInfo field in clazz.GetFields(AllDeclaredMembers))
{
GetElementDependencies(AsCustomAttributeProvider(field), result);
}
foreach (MethodInfo method in clazz.GetMethods(AllDeclaredMembers))
{
GetElementDependencies(AsCustomAttributeProvider(method), result);
#if COMPACT
if (method.ReturnTypeCustomAttributes != null)
GetElementDependencies(AsCustomAttributeProvider(method.ReturnTypeCustomAttributes), result);
#else
if (method.ReturnParameter != null)
GetElementDependencies(AsCustomAttributeProvider(method.ReturnParameter), result);
#endif
foreach (ParameterInfo parameter in method.GetParameters())
GetElementDependencies(AsCustomAttributeProvider(parameter), result);
}
return result;
}