using System;
using System.Reflection;
using System.Collections;
class MainClass {
public static void Main(string[] args) {
if (args.Length >= 2)
CheckBaseClass(args[0], args[1]);
}
public static void CheckBaseClass(string AssemblyName,string ClassName) {
Assembly assembly = Assembly.LoadFrom(AssemblyName);
if (assembly == null) {
Console.WriteLine("Unable to open {0}",AssemblyName);
return;
}
foreach (Type t in assembly.GetTypes()) {
if (t.IsClass == false)
continue;
Type baseType = t.BaseType;
while (baseType != null) {
if (baseType.FullName.EndsWith(ClassName)) {
Console.WriteLine("Class {0} is derived from {1}",t.FullName, ClassName);
}
baseType = baseType.BaseType;
}
Type[] intfc = t.GetInterfaces();
foreach (Type itf in intfc) {
if (itf.FullName.EndsWith(ClassName)) {
Console.WriteLine("Class {0} is derived from intf {1}",t.FullName, ClassName);
}
}
}
}
}
|