问题:使用通用列表的方法需要很长时间来处理。因此,该方法应该放在后台工作人员中。
问题如下:如何从Backgroundworker访问通用列表?
[Call]
backgroundWorker.RunWorkerAsync(new Tuple<string, int, List<T>>(aInfo, aCount, aGenericList));
...
[DoWork]
private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
{
BackgroundWorker worker = sender as BackgroundWorker;
Tuple<string, int, List<T>> aTuple = (Tuple<string, int, List<T>>)e.Argument; // won't work as <T> is not known
...
}
我想做类似的事情
private void backgroundWorker_DoWork<T>(object sender, DoWorkEventArgs e, List<T> theList) where T : Interface
但不知道如何使用它。
我错过了一些明显的东西吗?