Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Threading;
- namespace DynamicThreads
- {
- class Program
- {
- static int y = 0;
- static void SomeFunction()
- {
- y = 10;
- }
- static void Main(string[] args)
- {
- for (int i = 0; i < 100; i++)
- {
- y = 20;
- Thread thread = new Thread(SomeFunction);
- thread.Start();
- Console.Write("{0} ", y);
- }
- Console.Read();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment