这可能是一个愚蠢的问题,但是我有一种方法可以使页面的语法更易于阅读
public void Do(Delegate method, DispatcherPriority priority = DispatcherPriority.Normal)
{
this.Window.Dispatcher.BeginInvoke(method, DispatcherPriority.Background);
}
然后我可以写
Do(new Action(() =>
{
//DoStuff()
}));
但是,我想将 Action 移到 Do 方法中,这样我就可以写得更简单:
Do(() =>
{
//DoStuff()
}));
但我有点确定如何编写逆变参数来执行 Do 方法?