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
A leaked Telegram discussion by 50 so-called crypto influencers has exposed the extraordinary steps they take in order to profit on the back off unsuspecting defi investors. According to a leaked screenshot of the chat, an elaborate plan to defraud defi investors using the worthless “$Few” tokens had been hatched. $Few tokens would be airdropped to some of the influencers who in turn promoted these to unsuspecting followers on Twitter.
A Telegram spokesman declined to comment on the bond issue or the amount of the debt the company has due. The spokesman said Telegram’s equipment and bandwidth costs are growing because it has consistently posted more than 40% year-to-year growth in users.