IEnumerable, IEnumerator, IQueryable in C# .NET — Transcript
Full transcript
- 0:01what is I enumerable in C in the code
- 0:04here is a list of employee okay and in
- 0:07employee class we have ID and name
- 0:10property now here we are adding new
- 0:13employees in the code list here okay in
- 0:15the list here okay then we are running a
- 0:17for each Loop to print the employees ID
- 0:18and names one by one now the loop is
- 0:21working for the employee list this Loop
- 0:23is working because uh this Loop how this
- 0:26Loop is working because the list is
- 0:28derived from I in able interface only
- 0:31and I inter I enumerable interface is
- 0:34used when we want to iterate among our
- 0:37collection classes using a forre loop
- 0:40you might not use it directly this iable
- 0:44but all our collection classes like list
- 0:47which are able to use for each Loop are
- 0:50internally using this iable interface
- 0:53like if I will right click on this list
- 0:55collection and go to the definition and
- 0:58see list is derived from from the I
- 1:00numerable right that's it so internally
- 1:04all the collections are using iable
- 1:06interface so then only we are able to
- 1:09iterate the loop uh the collections
- 1:11through the for each Loop what is the
- 1:14difference between I inable and I
- 1:16numerator in C let's see the code first
- 1:20you know list is using I numerable
- 1:22internally right and here we are
- 1:24assigning list to I numerable and then
- 1:27iterating okay and here is the output
- 1:30now you can do the same thing using I
- 1:32enumerator also see here we call get
- 1:35enumerator method and use move next
- 1:37method to iterate through the results
- 1:40and it will give exactly the same output
- 1:43which iable was giving but the
- 1:45difference is iable code looks simp
- 1:49looks simple to implement right so
- 1:51basically iable internally uses I
- 1:55numerator only to iterate The Collection
- 1:57via for each Loop but we use I numerable
- 2:01because I numerable simplifies the use
- 2:04of I numerator see list is inherited
- 2:07from I numerable and I numerable uses I
- 2:11numerator interface and if you right
- 2:14click on I numerable and go to the
- 2:16definition then see here you will find
- 2:18the get enumerator method which is rning
- 2:21the type of the I numerator that's
- 2:26it now here is a very important question
- 2:29what is the difference between I
- 2:31numerable and I queriable in C why to
- 2:34use I queriable for SQL queries we
- 2:38already know what is I enumerable right
- 2:40now we will more focus on I quable first
- 2:44remember this point about I quable I
- 2:47quable inherited from I numerable
- 2:49interface only so anything you can do
- 2:52with I numerable you can also do that
- 2:55with I variable also for example
- 2:58iterating the collection can be done by
- 3:00both I numerable and I variable when you
- 3:04right click and see the definition of I
- 3:06quable you will find this see I quable
- 3:09is inherited from I numerable so
- 3:12whatever I numerable can do I queriable
- 3:15can also do in addition I queriable can
- 3:18perform some extra tasks related to SQL
- 3:21queries that I will shortly explain okay
- 3:25now see the code here here we have a
- 3:27list which we are iterating using I
- 3:30numerable and here is the output now we
- 3:33can use I quable also to iterate the
- 3:36same list and we will get the same
- 3:38result now the point is why we need I
- 3:42quable when I enumerable is already
- 3:44there the reason is inable is used with
- 3:49and it is preferred with in memory
- 3:51collections like array array list all
- 3:54these are in memory collections in
- 3:56memory objects also you can see whereas
- 3:59I variable is better in getting results
- 4:02from database so suppose you want to get
- 4:05records from database through linku okay
- 4:08for that first you will uh first of you
- 4:12you will use iable like this uh do not
- 4:15worry about the linku and Lambda
- 4:17expression here that I will explain in
- 4:19other videos but you are understanding
- 4:22this right here here we are getting the
- 4:24records from the employees table where
- 4:27the employees name start with h right
- 4:30and you will get the filtered result in
- 4:33this list e okay now the same result you
- 4:36can get by using I queriable interface
- 4:39also see the same query and you will get
- 4:42the same result in list Q this time but
- 4:46the point is I quable will take less
- 4:49time as comparison to I numerable now
- 4:52let me explain this
- 4:54why if you use iable then first the
- 4:58request will go to the database and
- 5:00bring the whole data from the database
- 5:03and then the filter the result at the
- 5:06server side here so bringing the whole
- 5:09data from the network will impact the
- 5:11performance in a negative way right
- 5:14because the data is too much okay on the
- 5:17other hand if you use iable then the the
- 5:22request will go to the database filter
- 5:24the data then and there only and then
- 5:27send back the filtered data data not the
- 5:30whole data which is good for performance
- 5:33because data is lesser the filter data
- 5:35is lesser so that is the reason I
- 5:38queriable is better than I enumerable
- 5:41for SQL queries and database operation
- 5:44all the points I have explain I have
- 5:47said are written here only so that later
- 5:50anyone can refer this uh PowerPoint and
- 5:53for the revision
- 5:54purpose one more point I variable is
- 5:57under system. linku name space whereas
- 6:00iable is under system. collections name
- 6:04space that is all about I nameable and I
- 6:07quable
- 6:09[Music]
About this transcript
This page contains the full transcript of IEnumerable, IEnumerator, IQueryable in C# .NET by Interview Happy, generated from the public captions YouTube serves with the video. The transcript has 928 words across 130 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.