Тёмный

LINQ Internals (Deep dive into Where) 

DotNet Core Central
Подписаться 27 тыс.
Просмотров 17 тыс.
50% 1

LINQ or Language-Integrated Query is a framework or technology based on integrated query capacity into .Net Core (or .Net Framework) languages like C#. It was released with version 3.0 of C# and been ever since an integral part of C# development.
LINQ is arguable one of the most powerful features of C# which has increased developer productivity by multiple folds.
In this video, I will first walk through creating an application to use the Where statement of LINQ to filter out all even numbers from a number array. And then I will subsequently implement the same function from scratch, to achieve the same outcome.
This will demonstrate what is the internal implementation of Where and how it all works together with other features of .Net.
The three main constituents or feature of the C# programming language that is necessary for the implementation of a Where query is as follows:
1. First, the Extension Method
2. Second, Delegate (in the case of Where it is Func)
3. And last but not the least "yield return" statement
The "yield return" statement is the one that makes LINQ queries to execute lazily. Meaning a LINQ query is executed only when we loop through the IEnumerable.
This is the first video of a series I want to cover on the internals of some of the .Net Core/C# language features.

Опубликовано:

 

6 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 12   
@aaronbcj
@aaronbcj 5 месяцев назад
For IQueryable.Where , the where is converted to an expression and executed at datasource once, at the start of a client iteration (or ToList). LINQ provider determines how data arrives from DB to client (batch by batch or all) and provides a wrapper over retrieved data for the client to iterate through the batch, before getting the next batch of results from DB (usually DB don't send entire resultsets at one go to minimize network usage)
@MartinHAndersen
@MartinHAndersen Год назад
A suggestion. The name could be Filter
@Sourav_29
@Sourav_29 Месяц назад
great explanation, thanks
@DotNetCoreCentral
@DotNetCoreCentral 14 дней назад
Glad it was helpful!
@pramodwayal4207
@pramodwayal4207 2 года назад
Nice explanation
@krnal21
@krnal21 4 года назад
good to know, thanks a lot, Subscribed to your channel. Very interesting videos.
@DotNetCoreCentral
@DotNetCoreCentral 4 года назад
Thanks for watching!
@prasath6786
@prasath6786 3 года назад
Excellent
@DotNetCoreCentral
@DotNetCoreCentral 3 года назад
@PRASATH, thanks!
@aminejadid2702
@aminejadid2702 4 года назад
Nice vid
@DotNetCoreCentral
@DotNetCoreCentral 4 года назад
Thanks!
@kvelez
@kvelez 5 месяцев назад
var items = new[] { 1, 2, 3, 4, 5 }; var elements = items; Console.WriteLine(string.Join(" ", items)); Console.WriteLine(string.Join(" ", elements)); items.ToList().ForEach(x => Console.Write(x + " ")); Console.WriteLine(); elements.ToList().ForEach(x => Console.Write(x + " ")); ======================== var items = new[] { 1, 2, 3, 4, 5 }; var elements = items; Console.WriteLine(string.Join(" ", items)); Console.WriteLine(string.Join(" ", elements)); items.ToList().ForEach(x => Console.Write(x + " ")); Console.WriteLine(); elements.ToList().ForEach(x => Console.Write(x + " ")); var evenItems = items._newWhere(x => x % 2 == 0); Console.WriteLine(); Console.WriteLine(string.Join(" ", evenItems)); public static class IEnumerableExtension { public static IEnumerable _newWhere(this IEnumerable items, Func predicate) { foreach (var item in items) { if (predicate(item)) { yield return item; } } } }
Далее
Internals of Select and SelectMany (LINQ Internals)
15:33
Women’s Free Kicks + Men’s 😳🚀
00:20
Просмотров 9 млн
Тренд Котик по очереди
00:10
Просмотров 347 тыс.
IDisposable Design Pattern (.Net Core)
12:29
Просмотров 11 тыс.
Brutally honest advice for new .NET Web Developers
7:19
Reflection introduction for .NET Core (C#)
19:56
Просмотров 11 тыс.
Understanding how to use Task and ValueTask
26:59
Просмотров 28 тыс.