I'm getting an AmbigiousMatchException for a function calling Type.GetMethod() even though everything looks pretty much correct.
public partial class IBaseEvent
{
private Dictionary<int, Func<object[], object>> funcs = new Dictionary<int,Func<object[],object>>();
private Dictionary<int, object[]> func_args = new Dictionary<int,object[]>();
public void Execute()
{
int exp = 0;
foreach(var func in funcs)
{
exp = func.GetHashCode();
func.Value.DynamicInvoke(func_args[exp]);
}
}
public void AddFunction(Type T, dynamic sFunc, params object[] parameters)
{
funcs.Add(T.GetHashCode(), new Func<object[],object>(T.GetMethod(sFunc)));
func_args.Add(T.GetHashCode(), parameters);
}
}
public class DummyEvent : IBaseEvent
{
private string EventType = "DUMMY_EVENT";
public DummyEvent()
{
object[] parm = new object[3];
parm[0] = Logging.LOG_TYPE.DEBUG;
parm[1] = "Hello World from DummyEvent! TypeCode: {0}";
parm[2] = typeof(DummyEvent).GetType().GUID;
AddFunction(typeof(Logging.LoggingFactory), "WriteToLog", parm);
}
}
Errors on AddFunction(typeof(Logging.LoggingFactory), "WriteToLog", parm);
What am I doing wrong? and how can I correct this?