如果我有这个
private static List<Action> actions = new List<Action>();
private static void Main()
{
for (var i = 0; i < 10; i += 1)
{
Action action = async () => {
// want to remove this specific lambda item from the "actions" variable.
// is there something like this:
/*
Action this_action = this;
actions.Remove(this_action);
*/
};
actions.Add(action);
}
Parallel.Invoke(actions.ToArray());
Console.Write("\nPress any key to exit...");
Console.ReadKey();
}
如何从列表中正确删除它。我需要某种自我参考?
皈依舞
相关分类