-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
28 lines (23 loc) · 763 Bytes
/
Copy pathProgram.cs
File metadata and controls
28 lines (23 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Threading;
class Program
{
static void RecursiveMethod(object depthObj)
{
Console.OutputEncoding = System.Text.Encoding.Unicode;
Console.InputEncoding = System.Text.Encoding.Unicode;
int depth = (int)depthObj;
Console.WriteLine($"Потік ID: {Thread.CurrentThread.ManagedThreadId}, Глибина: {depth}");
if (depth > 0)
{
Thread newThread = new Thread(RecursiveMethod);
newThread.Start(depth - 1);
}
}
static void Main()
{
Console.WriteLine("Початок роботи програми...");
RecursiveMethod(5);
Console.WriteLine("Головний потік завершився.");
}
}