public static Dictionary<string, Type> SearchAssembly( Assembly assembly, Type baseType )
{
Dictionary<string, Type> types = new Dictionary<string, Type>();
try
{
foreach ( Type type in assembly.GetTypes() )
{
if ( !type.IsAbstract )
{
if ( baseType.IsInterface )
{
foreach ( Type typeInterface in type.GetInterfaces() )
{
if ( typeInterface == baseType )
{
types.Add( type.FullName, type );
break;
}
}
}
else
{
Type parentType = type.BaseType;
while ( parentType != null )
{
if ( parentType == baseType )
{
types.Add( type.FullName, type );
break;
}
parentType = parentType.BaseType;
}
}
}
}
}
catch ( ReflectionTypeLoadException ex )
{
string dd = ex.Message;
}
return types;
}