我有以下代码:
public partial class WaitScreen : Form
{
    public Action Worker { get; set; }
    public WaitScreen(Action worker)
    {
        InitializeComponent();
        if (worker == null)
            throw new ArgumentNullException();
        Worker = worker;
    }
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        Task.Factory.StartNew(Worker).ContinueWith(t => { this.Close(); }, TaskScheduler.FromCurrentSynchronizationContext());
    }
}
这是消费者中的代码:
private void someButton_Click(object sender, EventArgs e)
{
    using (var waitScreen = new WaitScreen(SomeWorker))
        waitScreen.ShowDialog(this);
}
private void SomeWorker()
{
    // Load stuff from the database and store it in local variables.
    // Remember, this is running on a background thread and not the UI thread, don't touch controls.
}
现在,我必须在 Action "SomeWorker" 中添加一个参数,例如:
private void SomeWorker(Guid uid, String text)
    {
        // here will execute the task!!
    }
如何将参数uid和text传递给 Action?
是否可以使其通用,以便我可以传递任何参数,以便它可以使用任何数量和类型的参数?
任何帮助表示赞赏!