using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
namespace reflection
{
class Program
{
static void Main(string[] args)
{
Assembly asm = Assembly.LoadFrom(@"D:\meghawebsite\reflassm\reflassm\bin\Debug\reflassm.dll");
Type[] type = asm.GetTypes();
foreach (Type t in type)
{
if (t.Name == "mycls")
{
MethodInfo[] minfo = t.GetMethods();
foreach (MethodInfo m in minfo)
{
if (m.Name == "show")
{
ConstructorInfo[] cinfo = t.GetConstructors();
object clsobj = cinfo[0].Invoke(null);//To invoke the constructor to return the object
Object[] ob = new object[] {10};// The method has only one parameter of int type.
m.Invoke(clsobj, ob);//Invoke method by passing two parameters one is object and another is its parameter value
}
}
}
}
Console.ReadLine();
}
}
}