class Program { static void Main() { var actions = new List<Action>();
for (int i = 0; i < 3; i++) { actions.Add(() => Console.WriteLine(i)); }
foreach (var action in actions) action(); } }
Варианты ответа: A)
1 2
B)
3 3
C)
0 0
D)
---
✅ Правильный ответ: B
Почему: Лямбда-функции захватывают переменную i по ссылке, а не её значение на каждой итерации. После завершения цикла i == 3, и все замыкания ссылаются на одно и то же i. Это классическая ловушка замыканий в C#.
class Program { static void Main() { var actions = new List<Action>();
for (int i = 0; i < 3; i++) { actions.Add(() => Console.WriteLine(i)); }
foreach (var action in actions) action(); } }
Варианты ответа: A)
1 2
B)
3 3
C)
0 0
D)
---
✅ Правильный ответ: B
Почему: Лямбда-функции захватывают переменную i по ссылке, а не её значение на каждой итерации. После завершения цикла i == 3, и все замыкания ссылаются на одно и то же i. Это классическая ловушка замыканий в C#.
BY C# 1001 notes
Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283
Mr. Durov launched Telegram in late 2013 with his brother, Nikolai, just months before he was pushed out of VK, the Russian social-media platform he founded. Mr. Durov pitched his new app—funded with the proceeds from the VK sale—less as a business than as a way for people to send messages while avoiding government surveillance and censorship.
Start with a fresh view of investing strategy. The combination of risks and fads this quarter looks to be topping. That means the future is ready to move in.Likely, there will not be a wholesale shift. Company actions will aim to benefit from economic growth, inflationary pressures and a return of market-determined interest rates. In turn, all of that should drive the stock market and investment returns higher.