yep, its possible...
you can get it over the example below.
here I have created a DummyClass
namespace DummyClass
{
public class DummyClass
{
public int Add(int x, int y)
{
return x + y;
}
public int Sub(int x, int y)
{
return x - y;
}
}
}
and I am going to
Invoke pirticular method Add() of the DummyClass using reflection
private void CallReflection()
{
Assembly assembly;
Type type;
MethodInfo[] Methods;
object result = null;
object classObject;
MethodInfo mdInfo;
ParameterInfo[] ParameterTypes;
string asmName = @"D:\Reflection\..\bin\Debug\DummyClass.dll";
assembly = Assembly.LoadFile(asmName);
type = assembly.GetType("DummyClass.DummyClass");
Methods = type.GetMethods();
classObject = Activator.CreateInstance(type);
mdInfo = classObject.GetType().GetMethod("Add");
ParameterTypes = mdInfo.GetParameters();
if (ParameterTypes.Length > 0)
{
object[] argument ={ 9,6};
result = mdInfo.Invoke(classObject, argument);
}
else
{
result = mdInfo.Invoke(classObject, null);
}
if (result != null)
MessageBox.Show(result.ToString());
}
Think it would help you to clarify your problem.
Cheers,
Vasanth