标签:
1.Task.Run();
static void Main(string[] args)
{
long a = 9876545678, b = 987654567892;
Task task = Task.Run(() =>
{
Add(a, b);
});
Console.ReadLine();
}
static void Add(long a,long b)
{
Console.WriteLine("This is the Add method!");
Console.WriteLine("{0}+{1}={2}", a, b, a + b);
}
2.Task.Start();
static void Main(string[] args)
{
long a = 9876545678, b = 987654567892;
Task task = new Task(() =>
{
Add(a, b);
});
task.Start();
Console.ReadLine();
}
static void Add(long a,long b)
{
Console.WriteLine("This is the Add method!");
Console.WriteLine("{0}+{1}={2}", a, b, a + b);
}
标签:
原文地址:http://www.cnblogs.com/Fred1987/p/5774638.html