C#,Task
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);
}