在这段代码中:
public bool SomeMethod(out List<Task> tasks)
{
var task = Task.Factory.StartNew(() => Process.Start(info));
tasks.Add(task);
}
我收到一个错误“使用未分配的输出参数'任务'”。为什么?
在 MSDN 示例中,仅使用了out
参数
class OutExample
{
static void Method(out int i)
{
i = 44;
}
static void Main()
{
int value;
Method(out value);
// value is now 44
}
}
是因为List<T>
?