Тёмный

Understand your C# queries! IEnumerable & IQueryable in explained 

tutorialsEU - C#
Подписаться 21 тыс.
Просмотров 31 тыс.
50% 1

🔥 Learn the difference between IEnumerable and IQueryable! It is this EASY!
🚀 C# Progress Academy - Become a job-ready C# and Angular web developer to land your dream developer role: bit.ly/45vbPUg
Syncfusion Document Processing Library: syncf.co/3E0oCDw
Syncfusion ASP.NET Core Components: syncf.co/3roV8aE
We'll make sure to make a Developer out of you in no time!
So, what is C#?
C# (pronounced "See Sharp") is a modern, object-oriented, and type-safe programming language. C# enables developers to build many types of secure and robust applications that run in .NET. C# has its roots in the C family of languages and will be immediately familiar to C, C++, Java, and JavaScript programmers. This tour provides an overview of the major components of the language in C# 8 and earlier. If you want to explore the language through interactive examples, try the introduction to C# tutorials.
And what is IEnumerable?
Exposes an enumerator, which supports a simple iteration over a non-generic collection.
IEnumerable is the base interface for all non-generic collections that can be enumerated. For the generic version of this interface see System.Collections.Generic.IEnumerable. IEnumerable contains a single method, GetEnumerator, which returns an IEnumerator. IEnumerator provides the ability to iterate through the collection by exposing a Current property and MoveNext and Reset methods.
And what is IQueryable?
Provides functionality to evaluate queries against a specific data source wherein the type of the data is not specified.
The IQueryable interface is intended for implementation by query providers. It is only supposed to be implemented by providers that also implement IQueryable. If the provider does not also implement IQueryable, the standard query operators cannot be used on the provider's data source.
To learn more, make sure to watch the video, and we promise you that you'll become a C# developer by the end of the course! Have fun!
#csharp #coding #tutorial #learn #microsoft #net #I
TAGS
Tutorials,Tutorial,Programming,Course,Learn,Step by step,guide,development,programmer,video course,video tutorial,learn how to,how to,visual studio,c#,.net,.net core,dotnet,visual studio 2019,core,code,asp,asp net,c sharp,ienumerable,iqueryable,coding,linq,entity framework,entity framework core,csharp,iqueryable vs ienumerable,c# ienumerable vs iqueryable,iqueryable .net core,csharp interview,iqueryable vs ienumerable c#,ienumerable vs iqueryable c#
tutorialsEU offers you free video tutorials about programming and development for complete beginners up to experienced programmers.
This includes C#, Unity, Python, Android, Kotlin, Machine Learning, etc.
Stay tuned and subscribe to tutorialsEU: goo.gl/rBFh3x
C#: / @tutorialseuc
Facebook: / tutorialseu-1093802040...
LinkedIn: / tutorialseu
Discord: / discord

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

 

22 дек 2022

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 52   
@tutorialsEUC
@tutorialsEUC Год назад
🚀 C# Progress Academy - Become a job-ready C# and Angular web developer to land your dream developer role: bit.ly/45vbPUg
@HikingUtah
@HikingUtah 9 месяцев назад
IEnumerable is an interface. So in your examples, the IEnumerable also has 0 items--just like IQueryable. It's just an interface that you can use to iterate over the list of items (currently stored in your original List). And you don't get the items until you iterate the collection.
@Marfig
@Marfig 10 месяцев назад
Let's be clear here, the only reason why your example worked was that you decided to split the IEnumerable into two separate queries. Had you used the Where() extension method in the declaration of your enumerable object, and you would also have only returned 2500 customers through the network. In your example, there's actually no advantage in using one over the other. I think you can make a better video explaining the differences between IQueryable and IEnumerable if you focus on its actual benefits: With IQueryable, you can more easily compose queries dynamically based on runtime conditions. And you should avoid examples where you use IQueryable outside your ORM layer, unless you make it clear that doing so is actually not going to allow you to easily replace your ORM in the future.
@GuildOfCalamity
@GuildOfCalamity Год назад
Nice video! Would like to see more like this. For your tutorials I would highly recommend enabling "Display inline type hints" and "Display inline parameter name hints" in your VS options so that your viewers can see what the var types are resolving to.
@fibs9456
@fibs9456 Год назад
It's a little bit misleading that your example is using an in-memory list. This does not show the true benefit of iqueryable since ienumerable is evaluated lazy as well.
@tutorialsEUC
@tutorialsEUC Год назад
Hi, true but that's why I said that the list is only to get any kind of data and best to ignore :) Got your point anyway!
@fibs9456
@fibs9456 Год назад
@@tutorialsEUC true that. I just was confused at the beginning because often watch this kind of video without audio. Nice video btw. Cheers
@patsornleuangsupornpong9819
@@tutorialsEUCI got the whole point in the video but what do you mean by this? Can you explain a bit more? What is evaluated lazy?
@OOpSjm
@OOpSjm Год назад
@@patsornleuangsupornpong9819 look up "lazy loading"
@felixpollan
@felixpollan 8 месяцев назад
5:18 "... IEnumerable is a real collection, it contains all the data..." is definitely wrong, the data are in the list behind the IEnumerable, the IEnumerable itself could be implemented without having any data underneath, the only limitation is that you can use IEnumerable just to move forward. So this is not a good answer in an interview, trust me!
@higherpurpose1212
@higherpurpose1212 5 месяцев назад
Man, I wish I knew this 10 years ago! It's an eye opener for me, thank you! I will check all your tutorials and subscribe!
@billyarredondopucp
@billyarredondopucp Год назад
Finally, I got it. Thank you so much!
@eugenevv
@eugenevv Год назад
Thank you for an amazing and easy explanation!
@simonroyjonesuk
@simonroyjonesuk Год назад
So helpful. Thanks a lot
@EMWMIKE
@EMWMIKE Год назад
the Ienumerable can be better if the sql don't have an index of revenue field. So sometimes it is actually better to do a bigger query and then filter from memory. Have happened to me a lot of times and implementing new indexes in big transaction tables in production is not easy. So before filtering sql stuff, do your index homework 😀 Good video !!
@Fkn1405
@Fkn1405 4 месяца назад
very well explained! Thank U!
@howto8709
@howto8709 Год назад
Nice video understood totally.
@TkrZ
@TkrZ Год назад
No benchmarks?
@pkmx-um9vb
@pkmx-um9vb 3 месяца назад
Really great explanation ... many thanks!
@fahreddinartuklu2620
@fahreddinartuklu2620 11 месяцев назад
thank you bro i understand it and i think there is no missing part. :)
@odeyjoshuasunday998
@odeyjoshuasunday998 8 месяцев назад
beautiful, i enjoyed it...simple differences between the two
@user-ue4if1of5c
@user-ue4if1of5c 10 месяцев назад
Great explanation 👌
@8ytan
@8ytan Год назад
Some of what you said is only true because you chose a list to back the IEnumerable. An IEnumerable doesn't have to be "real" data, e.g. you can make an IEnumerable that is infinitely large.
@tangomoocow
@tangomoocow 2 месяца назад
Great explanation!
@johncassidy3071
@johncassidy3071 Месяц назад
Am IEnumerable is often implemented as a coroutine that just promises to get you another element of you're willing to stick around for it. And if you stick around, you'll get them all.
@tusharparmar7142
@tusharparmar7142 Год назад
Thanks for sharing. Good content.
@tutorialsEUC
@tutorialsEUC Год назад
Thanks for watching!
@billymartin6497
@billymartin6497 5 месяцев назад
Would this be good for something like an auto complete, or would it be faster to just get the entire list first?
@ma-arufburad8826
@ma-arufburad8826 Год назад
Well explained.
@murtazachaudhary7262
@murtazachaudhary7262 Год назад
Very well explained, using it from long time, but donot know the differences 😢
@KBHASKAR-
@KBHASKAR- 7 месяцев назад
Thanks bro for vedios
@chellaack1644
@chellaack1644 Год назад
Awesome
@jannickbreunis
@jannickbreunis Год назад
Hello Jannick! Good video, although I have to search how to retrieve/create a IQuerable with my DataAcces and sql.
@tutorialsEUC
@tutorialsEUC Год назад
Great suggestion!
@housamalamour7888
@housamalamour7888 Год назад
Fantastic Explanation, very clear and easy to understand. Keep it up man!
@tutorialsEUC
@tutorialsEUC Год назад
Glad you liked it!
@ferenc3460
@ferenc3460 Год назад
Great! Now I know the difference but what is the benefit of Ienumerable then? Or when I work with DB should I always use queryable?
@tutorialsEUC
@tutorialsEUC Год назад
The benefit is that IEnumerable is a collection (like a list or an array) and you can iterate over the elements. The queryable is no collection. Benefit is the wrong termination here :) Greets!
@attilaguba856
@attilaguba856 Год назад
Thanks very much! Nice one! So basically it's better to use IQueryable to filter data instead IEnumarble!?
@tutorialsEUC
@tutorialsEUC Год назад
Yes, exactly
@ygtandoh
@ygtandoh Год назад
Also once u apply a toList() or toArray() to an iQueryable it becomes an iEnumerable
@khabbazz89
@khabbazz89 Год назад
nice work
@tutorialsEUC
@tutorialsEUC Год назад
Thank you! Cheers!
@ivanvincent7534
@ivanvincent7534 6 месяцев назад
The in memory List negatively effects the example. Setting this up with EFCore would place IQueryable and IEumerable in the correct context.
@user-qo7yb2hl3q
@user-qo7yb2hl3q 8 месяцев назад
easy explanation!
@ieminu1875
@ieminu1875 10 месяцев назад
* support comment *
@marcelomilbradt6562
@marcelomilbradt6562 8 месяцев назад
This video just wrong; both IQueryable and IEnumerable will only execute the code when you iterate through the collection. Both implementations have the same impact on the database since the code is converted to SQL when using a ORM. Also, how can you claim that ICollection is faster without providing any data or benchmarks?
@gedwistle1974
@gedwistle1974 5 месяцев назад
What you're saying about IEnumerable being an actual collection with data vs IQueryable not having data, is just WRONG. IEnumerable is just an Interface, IQueryable actually implements IEnumerable! All IQueryable instances are already IEnumerables.
@Turko77777
@Turko77777 11 месяцев назад
IEnumerable is NOT a real collection
@Telee_Pawt
@Telee_Pawt 7 месяцев назад
Does anybody actually know what is going on with this stuff? We see heaps of examples everywhere but no informationon how anything actually works. Typical "aah" moment to be dashed again below by opposing views.
Далее
CREATE and CONNECT DATABASES in ASP.NET
18:11
Просмотров 46 тыс.
Beginner CRASH COURSE for IEnumerable in .NET C#
14:13
Вечный ДВИГАТЕЛЬ!⚙️ #shorts
00:27
Просмотров 889 тыс.
Problème ESLint sur REACT (résolu)
3:38
IEnumerable 🆚 IEnumerator Interfaces in C#
34:06
Просмотров 27 тыс.
How IEnumerable can kill your performance in C#
11:02
Просмотров 113 тыс.
C# Yield Return: What is it and how does it work?
15:09
Premature Optimization
12:39
Просмотров 764 тыс.
C# IEnumerable & IEnumerator
25:15
Просмотров 33 тыс.