//WARNING UNTESTED
using System;
using System.Reflection;
class reflectionSnippet
{
public static int Main()
{
dumpMethods(@"\projects\debug\snippets\cssnippets.dll");
return 0;
}
public static void dumpMethods(string assemblyPath)
{
Assembly a = Assembly.LoadFrom(assemblyPath);
foreach (Type type in a.GetTypes())
{
MethodInfo[] methods = type.GetMethods();
foreach (MethodInfo mi in methods)
{
//verify 'void fn()' signature
if (!mi.ReturnType.ToString().Equals("System.Void")) continue;
ParameterInfo[] pi = mi.GetParameters();
if (pi.Length != 0) continue;
Console.WriteLine("method: {0}", mi.Name);
//object y = a.createinstance("x.y.z");
//mi.Invoke(theTest, null);
}
}
}
}
|