Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Diagnostics;
- using System.Threading;
- using System.Threading.Tasks;
- namespace Test
- {
- class Program
- {
- public static void Main(string[] args)
- {
- var rand = new Random();
- double d = rand.NextDouble();
- Stopwatch stopwatch = new Stopwatch();
- stopwatch.Start();
- //Parallel.For(0, 7, (int i) => { Thread.Sleep(1000); d *= (i + 1); });
- for (int i = 0; i <= 7; i++)
- {
- Thread.Sleep(1000); d *= (i + 1);
- }
- stopwatch.Stop();
- Console.WriteLine("Time elapsed: {0}", stopwatch.Elapsed);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement