I am trying load a function in a dll. The dll is loaded but just at the place of invoking the function, I am getting an exception
Ambiguous match found
Here is the code snippet.
Assembly dll = Assembly.LoadFrom(DLLPATH);
if (dll != null)
{
Type Tp = dll.GetType("ABCD.FooClass");
if (Tp != null)
{
Object obj = Activator.CreateInstance(Tp);
if (obj != null)
{
List = (List<String>)obj.GetType().GetMethod("Foo").Invoke(obj, null);
}
else
{
Console.WriteLine("obj is null");
}
}
Console.WriteLine("Type is null");
}
else
Console.WriteLine("Dll is not loaded");
Console.ReadKey();
The method which I am calling (i.e Foo
), does not accept any parameters and it is an overloaded method. Is that the place where I am going wrong or is it some other place?
Is there another way to invoke such methods which does not accept any parameters? I tried the solution posted here but it is not working.