c# (Csharp) and .NET :- Difference between IEnumerable and IEnumerator.

Поделиться
HTML-код
  • Опубликовано: 30 мар 2012
  • For more such videos visit www.questpond.com
    For more such videos subscribe ruclips.net/user/questpondvide...
    See our other Step by Step video series below :-
    Learn C# Step by Step goo.gl/FNlqn3
    Learn Design Pattern Step by Step:- goo.gl/eJdn0m
    Learn Angular tutorial step by step tinyurl.com/ycd9j895
    Learn MVC Core step by step :- tinyurl.com/y9jt3wkv
    Learn Azure Step by Step :- tinyurl.com/y6fmrech
    Learn SharePoint Step by Step in 8 hours:- goo.gl/XQKHeP
    Python Tutorial for Beginners:- • Python Tutorial for Be...
    Learn Data Science in 1 hour :- tinyurl.com/y5o7qbau
    Learn Power BI Step by Step:- tinyurl.com/y6thhkxw
    Learn MSBI Step by Step in 32 hours:- goo.gl/TTpFZN
    Learn SQL Server Step by Step tinyurl.com/ja4zmwu
    Learn Tableau step by step :- tinyurl.com/kh6ojyo
    In this c# video video we will try to understand in what scenarios we should use IEnumerable and what scenarios we should use IEnumerator.
    We are also distributing a 100 page Ebook ".NET Interview Questions ". If you want this ebook please share this video in your facebook/twitter/linkedin account and email us on questpond@questpond.com with the shared link and we will email you the PDF.

Комментарии • 253

  • @dnfvideo
    @dnfvideo  2 года назад

    Do not miss our Interview Question video series
    30 Important C# Interview Questions : ruclips.net/video/BKynEBPqiIM/видео.html
    25 Important ASP.NET Interview Questions : ruclips.net/video/pXmMdmJUC0g/видео.html
    25 Angular Interview Questions : ruclips.net/video/-jeoyDJDsSM/видео.html
    5 MSBI Interview Questions : ruclips.net/video/5E815aXAwYQ/видео.html

  • @ZhuShisubi
    @ZhuShisubi 10 лет назад +47

    This question has been going around for years and finally someone who just answered it in a very in-depth yet simple way. Thanks from Master Zhu! :)

  • @rajkumararora7366
    @rajkumararora7366 2 года назад +4

    Very well explained in simplistic words.
    This truely signifies the role of a good teacher.
    Shiv sir you are the best !!! Keep it up...

  • @muslimresearcher6062
    @muslimresearcher6062 5 лет назад +6

    I think the more accurate syntax for the difference between IEnumerable and IEnumerator is that: it is not the IEnumerable or IEnumerator maintains the state or not, but the technique of iteration through IEnumerable or IEnumerator rests the position or not.
    As you loop through IEnumerable with foreach loop, the foreach loop automatically resets the IEnumerable position to the initial position each time you iterate.
    While as you iterate through IEnumerator with MoveNext() method the position is maintained
    with the new iteration loop, because nothing automatically changes the position of IEnumerator and if you want the initial position of IEnumerator you must use Reset() method.
    So, the technique used to iterate through IEnumerable rests the position automatically
    each time you iterate, while The technique used to iterate through IEnumerator begins the iteration from the last IEnumerator position and no automatic reset is carried out in IEnumerator iteration.

  • @ssushovan
    @ssushovan 7 лет назад

    You are a life saver. Finally, I get the difference between these two now.

  • @tthamil
    @tthamil 9 лет назад

    I was very confused between IEnumerable and IEnumerator before the video, I had a very clear explanations from your videos in depth.Thank You.

  • @kingwoodbudo
    @kingwoodbudo 5 лет назад

    Thanks for making this much clearer. I appreciate your time.

  • @kopilkaiser8991
    @kopilkaiser8991 Год назад

    I had these exact questions and you have answered really well with simple and clear explanation. Thank you!

  • @mrsoo9687
    @mrsoo9687 7 лет назад +1

    i love your explanation! thank you so much! you saved me!

  • @nikolaypanchev
    @nikolaypanchev 9 лет назад

    Simple and clear explained. Thank You!

  • @henryv4222
    @henryv4222 7 лет назад

    good entertaining explanations- I use it for looping through controls in forms apps but I didn't know what differences between the two were

  • @zuzuba3481
    @zuzuba3481 4 года назад

    Well done. No words to appreciate. Long time confusion is cleared..

  • @jimmynguyen7961
    @jimmynguyen7961 6 лет назад +1

    Love these videos. Very comprehensive explanations.

  • @factworld4375
    @factworld4375 5 лет назад

    Thanks sir ji.
    Loved the way u have explained it.

  • @ronaldabellano5643
    @ronaldabellano5643 5 лет назад

    Thank you! That’s a valuable information.

  • @mrk10000
    @mrk10000 4 года назад

    You always give excellent examples and analogy, thanks a lot for sharing

  • @aske1602
    @aske1602 10 лет назад

    Thanks I have been looking for a decent explanation of the difference between the two collections.

  • @sushmabaijv4158
    @sushmabaijv4158 10 лет назад +1

    Thank you very much now I got very clear idea about these two interfaces thanks once again

  • @kvguitarist
    @kvguitarist 10 лет назад +8

    Great video... Would just like to point out one thing... Maybe no one noticed it but at 12:25, you say "The Biggest difference between IEnumerable and IEnumerator is that IEnumerable REMEMBERS STATES while IEnumerable DOES NOT."
    I think you wanted to say "IEnumerator remembers states while IEnumerable does not" Obviously that was an accident. But just wanted to point out. Thank you so much for the help!

  • @LOGIGON
    @LOGIGON 10 лет назад

    Thanks, you made the Difference clear!

  • @idlevandal69
    @idlevandal69 6 лет назад

    Clear and concise explanation.. Awesome..

  • @phongchau1013
    @phongchau1013 8 лет назад

    Excellent explanation of the difference between the two. Thanks.

  • @rajendraprasad8814
    @rajendraprasad8814 12 лет назад

    The video was awesome...i was finding it difficult to understand the difference from many sites, this video was crisp and clear...kudos

  • @kvguitarist
    @kvguitarist 10 лет назад +7

    Also at 10: 16 we should pass int i in the IEnumerable example to 2nd function Iterate2001andAbove() instead of passing o (which is the full list). This will fix listing the years multiple times... :-)
    Hope that helps.. Thank you once again!

    • @MsRohit35
      @MsRohit35 4 года назад

      Was going to comment the same

  • @eladyehuda8827
    @eladyehuda8827 2 года назад

    You are a true professional and an excellent explanation

  • @SushrutKanetkar
    @SushrutKanetkar 7 лет назад

    Thanks ! Very clear explanation.

  • @vinaykrishnasharma5024
    @vinaykrishnasharma5024 8 лет назад +5

    Cleared a very important concept. Thanks a lot.

  • @rajkumarg5028
    @rajkumarg5028 4 года назад +1

    Great explanation ...u reduced my stresssss..

  • @bbabak2
    @bbabak2 4 года назад

    Perfect explanation. Thank you

  • @sebastiankumlin9542
    @sebastiankumlin9542 5 лет назад

    Better than most other explanations!

  • @yaarkhakf
    @yaarkhakf 9 лет назад +155

    now i can die in peace

  • @jamesjackson414
    @jamesjackson414 10 лет назад

    Very good video. As always, well explained, easy to follow code and example. Thanks for sharing with the world.

  • @iwo3324
    @iwo3324 7 лет назад

    Very good explaination, thank you ! Now I understand :D

  • @khurramsultan2040
    @khurramsultan2040 6 лет назад

    i dont know why some stupid people are disliking these videos. this guy has great way of teaching and he is doing it for free and on the other hand he is very well experienced and sharing his experience

  • @Benjam901
    @Benjam901 10 лет назад

    You cleared up a lot for me, thank you

  • @Kaboomnz
    @Kaboomnz 10 лет назад

    thankyou sir, nicely demonstrated :)

  • @thegr8raj1
    @thegr8raj1 6 лет назад

    Very nice explanation. Thanks for the video.

  • @jitendravirkayade3466
    @jitendravirkayade3466 7 лет назад

    it really help me to understand basic difference, Thanks,

  • @vexedev
    @vexedev 11 лет назад +1

    Maaaaan, THIS IS A TUTORIAL!!! Amaaaxxxxing :D

  • @thisisnehlem
    @thisisnehlem 3 года назад

    Thank your clear explation sir thumbs up from PH🇵🇭

  • @sdss315
    @sdss315 12 лет назад +1

    This is nice, I learned it,
    Thank you sir !

  • @saranjeetkaur5184
    @saranjeetkaur5184 6 лет назад

    Thanks a lot Sir for explaining very well.

  • @salimshaiks
    @salimshaiks 9 лет назад

    Really helpful video....Thanks a ton.

  • @VijayKumar-fs1mm
    @VijayKumar-fs1mm 9 лет назад

    Very good explanation, Thank you.....

  • @tchipilev9
    @tchipilev9 7 лет назад

    Very good explanation. Thank you dude !

  • @P0mpal0
    @P0mpal0 6 лет назад

    !Very clear explanation, thanks

  • @BrunoDemolishment
    @BrunoDemolishment 11 лет назад +1

    Wow, very good! Would you do a video on the ICollection interface, the IList interface and the IDictionary interface?
    You explaine very well peace

  • @sadaqat4728
    @sadaqat4728 3 года назад

    great work man. hardworking and talented people like you deserve subscribers and appreciation rather than those loser tiktokers.

  • @lifeinanutshell28
    @lifeinanutshell28 4 года назад

    i love your explanation! thank you so much! you saved me too ... :)

  • @aspnet4456
    @aspnet4456 6 лет назад

    Good explanation. Thanks!!!

  • @abhinandan4444
    @abhinandan4444 4 года назад

    Thanks for the explanation however, IEnumerator seems similar to Yield since both maintain state iteration state.
    What could be the possible difference between them and in what scenarios we should specifically use them?
    Thanks in advance

  • @dilshadansari8397
    @dilshadansari8397 9 лет назад

    Great Example..thanks alot..

  • @AhmadElkhouly
    @AhmadElkhouly 3 месяца назад

    Thank you. In short, IEnumerable is the collection itself that can be iterated.
    IEnumerator is an enumerator object that's used to iterate through a collection of data.
    So for a collection to be enumerable it must provide an enumerator object. IEnumerable exposes the GetEnumerator method that provides that enumerator.

  • @sahilchugh6482
    @sahilchugh6482 6 лет назад

    u r superb sir.. Keep helping us

  • @Archak77
    @Archak77 Год назад

    Excellent explanation sir ...Thank you 🙏

  • @ashamp1028
    @ashamp1028 11 лет назад

    Very nice and clear explanation... Thanks a lot

  • @kris4117
    @kris4117 2 года назад

    Now that I understood what I need to.... I am all set for Nirvana - Guru ji with your blessings.

  • @seanshimon
    @seanshimon 9 лет назад

    That example very good. Thanks.

  • @Bigblue_YT
    @Bigblue_YT 11 лет назад

    Tanks for this show. I learned a lot with video.

  • @cesarsc971
    @cesarsc971 10 лет назад

    Amazing example. Thanks

  • @joro353
    @joro353 6 лет назад

    Great video and thanks a lot!

  • @sarathbaiju6040
    @sarathbaiju6040 3 года назад

    Thank you for this very clear explanation

  • @sravankumar131
    @sravankumar131 5 лет назад

    Nice explanation...Thanks alot sir...

  • @Mckandy47
    @Mckandy47 6 лет назад

    Thalaivaaa. You are great !!!

  • @beydoin
    @beydoin 11 лет назад

    Amazing! Thanks.

  • @fcdario2763
    @fcdario2763 6 лет назад

    Thank you very much!

  • @mahalakshmip9618
    @mahalakshmip9618 5 лет назад

    Very good Explanation for Enumerator and Enumerable

  • @charlliemurphy8381
    @charlliemurphy8381 4 года назад

    Very good explanation, thank you.

  • @gen_jain
    @gen_jain 2 года назад

    Wow Sir Awesome ! Nicely explained loved it 😊😊

  • @tornadoofthoughts
    @tornadoofthoughts 6 лет назад

    Great explanation!

  • @dnfvideo
    @dnfvideo  12 лет назад

    Its already uploaded. we would like to clarify to everyone here what videos we upload on youtube are a very very small part what we have on questpondvd.

  • @sudhid8765
    @sudhid8765 3 года назад

    Super shiv sir thanks for making my learning easy. I got one doubt to make the ienumerable remember cursor position can we use getenumerator()?

  • @InshuMussu
    @InshuMussu 8 лет назад

    your second example made me clear

  • @achilleskocaeli
    @achilleskocaeli 12 лет назад

    man you are really good...

  • @highlightspoint6182
    @highlightspoint6182 8 лет назад

    excellent lecture clear view

  • @arun020391
    @arun020391 5 лет назад

    If foreach is the case and we're not interested in current position then why should we choose IEnumerable too instead of we might have use object of List in foreach right and why we go for IEnumerable? can you please anyone clear my doubt, Thank you.

  • @sankar6409
    @sankar6409 9 лет назад +1

    Great Good! explanations Thank you

  • @Nicetrycutiepie
    @Nicetrycutiepie 2 года назад

    Best example I have seen,it's registered in my mind.

  • @jackle9125
    @jackle9125 6 лет назад

    short and sweet :) tks

  • @fastdrive55
    @fastdrive55 11 лет назад

    Great tutorial.

  • @naveedalam2875
    @naveedalam2875 8 лет назад

    Thank you sir.

  • @ashamp1028
    @ashamp1028 10 лет назад

    Nicely explained... :)

  • @hemlatagehlot2717
    @hemlatagehlot2717 7 лет назад

    Nice video..thanks!

  • @rajeevjha3714
    @rajeevjha3714 5 лет назад

    Nicely explained.

  • @aldrinalmia3665
    @aldrinalmia3665 5 лет назад

    Nice! Thanks a lot!

  • @venkatasaisrikarganugapati7567
    @venkatasaisrikarganugapati7567 7 лет назад

    Decent Explanation.

  • @takeshiscastlelovers4524
    @takeshiscastlelovers4524 2 года назад

    Thanks a lots keep posting for us please 🙏👍 ☺️

  • @arunntbe
    @arunntbe 11 лет назад +1

    Really nice video!! you have mentioned that IEnumeratble internally uses IEnumerator, so why it does not remember the current cursor position?

  • @CRBarchager
    @CRBarchager 9 лет назад

    This cleared things up for me. Thank you very much!

  • @jz1838
    @jz1838 9 лет назад

    good video. Thanks

  • @curryjl1027
    @curryjl1027 6 лет назад

    10/10 would watch again

  • @MrJojo1089
    @MrJojo1089 9 лет назад +4

    A nice one. am just bit confused why did you need an explicit casting while creating the IEnumerable?The list was anyway of int right???

    • @Grygier94
      @Grygier94 7 лет назад +2

      It's not about int, it's about IEnumerable. Because List implements more interfaces, not only IEnumerable and generally has more features. So when you store the reference of list in IEnumerable you won't have access to all List features, just the features IEnumerable implements. You got to cast it explicitly because you limit it functionality.

    • @MerinNakarmi
      @MerinNakarmi 5 лет назад

      By limiting the functionality, does it have any benefit, like in terms of time and memory?

  • @deepakbhola9050
    @deepakbhola9050 11 лет назад

    nice exemple.thanks

  • @rajasekharjangam4999
    @rajasekharjangam4999 3 года назад

    Super explanation bro..

  • @nishatmazhar7127
    @nishatmazhar7127 9 лет назад

    Good job!

  • @sixpetrov
    @sixpetrov 10 лет назад

    thank you

  • @Nashfanfl13
    @Nashfanfl13 9 лет назад +1

    Well you got yourself a subscriber your video was very informational and much appreciated :P

  • @tomargs1978
    @tomargs1978 11 лет назад

    Very nice...Thanks

  • @pankajjha1914
    @pankajjha1914 4 года назад

    thnku sir. it was very helpful.

  • @maximus392
    @maximus392 9 лет назад

    neat and good example