我哈瓦委托如何调用匿名委托动态
public delegate void Context();
,我不得不通过匿名方法来实现它,
public Context fakeHttpContext =() =>
{
...
create fake http context.
};
我不”想
fakeHttpContext.Invoke()
执行fakeHttpContext
我不知道我是否可以通过已知委托名称来调用它。有反射任何喜欢:
DelegateInfo info = typeof(class).GetDelegate("fakeHttpContext");
info.Invoke();
感谢
你能否提供何时何地使用它? –