TO Get All Information from DLL
Assembly assembly = Assembly.LoadFrom(@"C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0\Additionsusersandip0.dll");
Type[] t = assembly.GetTypes();
foreach (Type tt in t)
{
if (tt.IsClass) Console.WriteLine("Name space is = " + tt.Namespace);
MethodInfo[] mi = tt.GetMethods();
Console.WriteLine(mi.ToString());
foreach (MethodInfo methodinfo in mi)
{
ParameterInfo[] pi = methodinfo.GetParameters();
Console.WriteLine(methodinfo.Name);
Console.WriteLine(methodinfo.ReturnType.ToString());
Console.WriteLine(methodinfo.ReturnParameter.ParameterType.ToString());
foreach (ParameterInfo p in pi)
{
p.GetType();
Console.WriteLine(p.Name);
Console.WriteLine(p.ParameterType);
}
}
}
To Invoke the DLL Method
Assembly myAssem = Assembly.LoadFile(strFullDummyDLLFilePath);
Type[] t = myAssem.GetTypes();
foreach (Type type in t)
{
if (type.IsClass)
{
Object objAssembly = Activator.CreateInstance(type);
object[] objInputParams = null;
objResult = type.InvokeMember(strMethodName, BindingFlags.InvokeMethod,null, objAssembly, new Object[] { objIPParameters });
}
}