我有一个代表
public delegate void Context();
我已经通过匿名方法实现了它,
public Context fakeHttpContext = () =>
{
...
create fake http context.
};
我不想通过执行 fakeHttpContext
fakeHttpContext.Invoke()
我想知道我是否可以通过已知的委托名称来调用它。反思中有什么喜欢的东西:
DelegateInfo info = typeof(class).GetDelegate("fakeHttpContext");
info.Invoke();
谢谢