Warning: mkdir(): No space left on device in /var/www/tgoop/post.php on line 37

Warning: file_put_contents(aCache/aDaily/post/csharpovich/--): Failed to open stream: No such file or directory in /var/www/tgoop/post.php on line 50
Профессор Си@csharpovich P.252
CSHARPOVICH Telegram 252
Что такое отложенное и немедленное выполнение в LINQ?

Ответ:

В LINQ отложенное выполнение означает, что запрос не выполняется в указанное время. В частности, это достигается путем присвоения запроса переменной. При этом определение запроса сохраняется в переменной, но запрос не выполняется до тех пор, пока переменная запроса не будет итерирована.

Например:

DataContext productContext = new DataContext();

var productQuery = from product in productContext.Products
where product.Type == "SOAPS"
select product; // запрос не выполняется

foreach (var product in productQuery) // запрос выполняется здесь
{
Console.WriteLine(product.Name);
}

Немедленное выполнение запроса полезно, например, если база данных часто обновляется, и в логике программы важно, чтобы результаты, к которым обращаются, были возвращены в той точке вашего кода, где был задан запрос. Немедленное выполнение часто вызывается с помощью таких методов, какAverage, Sum, Count, List, ToList или ToArray.

Например:

DataContext productContext = new DataContext();

var productCountQuery = (from product in productContext.Products
where product.Type == "SOAPS"
select product).Count(); // запрос выполняется здесь

#questions
🤡71



tgoop.com/csharpovich/252
Create:
Last Update:

Что такое отложенное и немедленное выполнение в LINQ?

Ответ:

В LINQ отложенное выполнение означает, что запрос не выполняется в указанное время. В частности, это достигается путем присвоения запроса переменной. При этом определение запроса сохраняется в переменной, но запрос не выполняется до тех пор, пока переменная запроса не будет итерирована.

Например:

DataContext productContext = new DataContext();

var productQuery = from product in productContext.Products
where product.Type == "SOAPS"
select product; // запрос не выполняется

foreach (var product in productQuery) // запрос выполняется здесь
{
Console.WriteLine(product.Name);
}

Немедленное выполнение запроса полезно, например, если база данных часто обновляется, и в логике программы важно, чтобы результаты, к которым обращаются, были возвращены в той точке вашего кода, где был задан запрос. Немедленное выполнение часто вызывается с помощью таких методов, какAverage, Sum, Count, List, ToList или ToArray.

Например:

DataContext productContext = new DataContext();

var productCountQuery = (from product in productContext.Products
where product.Type == "SOAPS"
select product).Count(); // запрос выполняется здесь

#questions

BY Профессор Си


Share with your friend now:
tgoop.com/csharpovich/252

View MORE
Open in Telegram


Telegram News

Date: |

As of Thursday, the SUCK Channel had 34,146 subscribers, with only one message dated August 28, 2020. It was an announcement stating that police had removed all posts on the channel because its content “contravenes the laws of Hong Kong.” As five out of seven counts were serious, Hui sentenced Ng to six years and six months in jail. The initiatives announced by Perekopsky include monitoring the content in groups. According to the executive, posts identified as lacking context or as containing false information will be flagged as a potential source of disinformation. The content is then forwarded to Telegram's fact-checking channels for analysis and subsequent publication of verified information. With Bitcoin down 30% in the past week, some crypto traders have taken to Telegram to “voice” their feelings. Find your optimal posting schedule and stick to it. The peak posting times include 8 am, 6 pm, and 8 pm on social media. Try to publish serious stuff in the morning and leave less demanding content later in the day.
from us


Telegram Профессор Си
FROM American