CSHARP_1001_NOTES Telegram 675
Вы используете локальные переменные в LINQ и используете let? 👇

Ключевое слово let позволяет вводить временную переменную прямо внутри запроса LINQ — как локальную переменную в цикле.

Разбивайте сложные вычисления на части

Делайте запрос модульнее и чище

Меньше проходов по данным → выше производительность

👉 Простой пример:
csharp


from order in orders
let total = order.Items.Sum(i => i.Price * i.Quantity)
where total > 1000
let categories = order.Items.Select(i => i.Category).Distinct()
select new
{
OrderId = order.Id,
Total = total,
Categories = categories
};

let total = … — вычисляем сумму заказа только один раз

where total > 1000 — фильтруем по готовому значению

let categories = … — собираем уникальные категории



tgoop.com/csharp_1001_notes/675
Create:
Last Update:

Вы используете локальные переменные в LINQ и используете let? 👇

Ключевое слово let позволяет вводить временную переменную прямо внутри запроса LINQ — как локальную переменную в цикле.

Разбивайте сложные вычисления на части

Делайте запрос модульнее и чище

Меньше проходов по данным → выше производительность

👉 Простой пример:
csharp


from order in orders
let total = order.Items.Sum(i => i.Price * i.Quantity)
where total > 1000
let categories = order.Items.Select(i => i.Category).Distinct()
select new
{
OrderId = order.Id,
Total = total,
Categories = categories
};

let total = … — вычисляем сумму заказа только один раз

where total > 1000 — фильтруем по готовому значению

let categories = … — собираем уникальные категории

BY C# 1001 notes




Share with your friend now:
tgoop.com/csharp_1001_notes/675

View MORE
Open in Telegram


Telegram News

Date: |

Telegram channels enable users to broadcast messages to multiple users simultaneously. Like on social media, users need to subscribe to your channel to get access to your content published by one or more administrators. According to media reports, the privacy watchdog was considering “blacklisting” some online platforms that have repeatedly posted doxxing information, with sources saying most messages were shared on Telegram. But a Telegram statement also said: "Any requests related to political censorship or limiting human rights such as the rights to free speech or assembly are not and will not be considered." Just as the Bitcoin turmoil continues, crypto traders have taken to Telegram to voice their feelings. Crypto investors can reduce their anxiety about losses by joining the “Bear Market Screaming Therapy Group” on Telegram. Developing social channels based on exchanging a single message isn’t exactly new, of course. Back in 2014, the “Yo” app was launched with the sole purpose of enabling users to send each other the greeting “Yo.”
from us


Telegram C# 1001 notes
FROM American