我在并行调用中做错了什么?
static void Main(string[] args)
{
TasteAll<HotCupOf>(TurnCoffeeVenMachineOn);
}
public static void TasteAll<Mode>(Action<Mode> Make)
{
foreach (Mode mode in Enum.GetValues(typeof(Mode)))
{
Task.Factory.StartNew(() => Make(mode) );
//Make(mode); //<-- Works Fine with normal call
}
Console.ReadLine();
}
enum HotCupOf
{
Black,
Latte,
Cappuccino,
Mocha,
Americano,
Espresso,
Chocolate,
Tea
}
public static void TurnCoffeeVenMachineOn(HotCupOf SelectedDrink)
{
Console.WriteLine(SelectedDrink);
}