IEnumerable 🆚 IEnumerator Interfaces in C#

Sdílet
Vložit
  • čas přidán 19. 04. 2021
  • 🚀 Master C# and .NET programming EASILY with our best-selling C# Masterclass: bit.ly/47Hk3u7
    Today's Advanced C# Topic is: IEnumerable and IEnumerator Interfaces
    In this video you will learn what IEnumerable and IEnumerator are
    What are advantages of IEnumerable and IEnumerator
    When to use them
    How to use them
    What are advantages of using IEnumerable and IEnumerato
    How IEnumerator and IEnumerable are related to lists, arrays, and other types of colletions.
    The IEnumerable interface is the base Interface for many collections in C#, and its job is to provide a way of iteration through a collection. That is why we can use foreach loops to go through a List or a Dictionary. In simple English when a collection class implements the IEnumerable interface it becomes countable, and we can count each element in it individually
    There are 2 versions of the IEnumerable Interface
    1.IEnumerable for generic collections
    2.IEnumerable for non generic collections
    But since generic collections were introduced later after the non-generic ones and it is no longer recommended to use the non-generic collections in a new project due to their need to perform boxing and unboxing (converting the types of objects), we will explain how to use the IEnumerable T interface in this lesson
    when it is recommended to use the IEnumerable interface:
    - Your collection represents a massive database table, you don’t want to copy the entire thing into memory and cause performance issues in your application.
    When it is not recommended to use the IEnumerable interface:
    - You need the results right away and are possibly mutating / editing the objects later on. In this case, it is better to use an Array or a List
    ienumerable vs ienumerator C#
    implementing ienumerable and ienumerator
    use of ienumerable and ienumerator in c#
    ienumerator in c example
    ienumerable vs ienumerablet
    why we use ienumerable in c
    ienumerable vs enumerable c
    ienumerator in c# geeksforgeeks
    interface in c# with example code project
    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

Komentáře • 41

  • @tutorialsEU
    @tutorialsEU  Před 3 lety +4

    🚀Master C# and .NET programming EASILY with our best-selling C# Masterclass: bit.ly/47Hk3u7
    Here is an article about IEnumerable and IEnumerator Interfaces with a complete code, enjoy!
    tutorials.eu/ienumerable-and-ienumerator/

  • @syafiighazali
    @syafiighazali Před 3 lety +9

    Super clear explanation - exactly what I needed!

  • @lowkeyhuman
    @lowkeyhuman Před 2 lety +6

    This is some top tier explanation, I have no choice but to subscribe :)

  • @oaksoeaung7646
    @oaksoeaung7646 Před 2 měsíci

    Thanks, a lot. This video helps me a lot.

  • @dayday8421
    @dayday8421 Před 3 lety +1

    Best explanation on CZcams. Thank you!

  • @simonroyjonesuk
    @simonroyjonesuk Před rokem

    Wow that was brilliant. I finally understand what IEnumerable does. I didn't know what a queue was, so I watched your video on that, which was also great. So well explained and really helpful. You are definitely my new go to source for C#. Thanks again. Simon

  • @FumeCreates
    @FumeCreates Před 3 lety +1

    Thank you so much for this video. Well explained and I received so much value

  • @bryanburger
    @bryanburger Před 2 lety +1

    Great job at conveying the principles!

  • @siestitrokot3843
    @siestitrokot3843 Před 2 lety

    Great demo! Thank you!

  • @DanFlakes
    @DanFlakes Před 3 lety

    Thanks for clearing it up!

  • @angel_machariel
    @angel_machariel Před rokem +1

    Good video. Question: how relevant is it to learn how to implement IEnumerator ? Should it be an urgent matter for post-beginner students/juniors or shouldn't one be bothered with it for now?

  • @carlossantamaria1820
    @carlossantamaria1820 Před rokem

    amazing video, now i understood what this mean, this video also helped me to see the importance of interfaces in general, not only IEnumerable interface.

  • @Gojam12
    @Gojam12 Před 2 lety

    Good practical and usable explanation

  • @BackeB
    @BackeB Před rokem

    The first ”ahaa” moment I’ve had regarding interfaces, when you described the issues presented without interfaces. So they provide similar functionality among othervise unrelated classes. For example 😁

  • @heshamabdo6024
    @heshamabdo6024 Před rokem

    Thank you so much for this video

  • @juniorlucival
    @juniorlucival Před 2 lety +1

    top top top, thanks, you are the best c# teacher .

  • @mrYtuser01
    @mrYtuser01 Před rokem

    Clean and Simple

  • @RealityCheck6T9
    @RealityCheck6T9 Před 2 lety

    Good video thanks

  • @Javier-uh7mb
    @Javier-uh7mb Před 3 lety +1

    Very interesting, thanks!

  • @andrewfedorov9198
    @andrewfedorov9198 Před rokem

    Well. I got the examples but I didn't get the main idea why do we need this "IEnumerable" thing? To treat List and int array with the same function? At the end they both are so we can collect List values to array first and just make a function to work only with arrays. Or array to list. Because they both are . So why do we need all of this?

  • @shubhangimane8556
    @shubhangimane8556 Před 3 lety +1

    nice video

  • @oblivion3799
    @oblivion3799 Před 2 lety

    Thank you ... you didn't cover anything necessary about it ... Very elementary ... but It helpful yet

  • @nikolazagorac8634
    @nikolazagorac8634 Před rokem

    Great video, why can't I save it?

  • @user-hg5sw1tj4u
    @user-hg5sw1tj4u Před rokem

    So we use IEnumerable, when we want introduce class like array or list. Yes?

  • @TheKr0ckeR
    @TheKr0ckeR Před 2 lety

    Instead of going, foreach loop shelter, couldnt we just loop though => shelter.dogs in the foreach looop since its public list?

  • @youtischia
    @youtischia Před 2 lety

    Good video but can you explain why it is necessary to have 2 interfaces Ienumerable and Ienumerator ? What is the need for Ienumerable when it is Ienumerator that does all the work ?

    • @maythesciencebewithyou
      @maythesciencebewithyou Před 2 lety

      from what I've heard, it's because when C# came out it didn't have generics yet and they built it on that.

  • @danielbereketsiyum825
    @danielbereketsiyum825 Před 10 měsíci

    Can we consider this as runtime polymorphism, because the IEnumerable interface is holding different array types at runtime?
    Thank you.

  • @andreashecht272
    @andreashecht272 Před 2 lety +2

    so just a logical question:
    Why don't we just make dogs a public list and itterate in the foreach loop through shelter.dogs?

    • @TheKr0ckeR
      @TheKr0ckeR Před 2 lety

      i have the same question in my head

  • @malcox5218
    @malcox5218 Před 2 lety

    7:38

  • @stbny4444
    @stbny4444 Před rokem

    was following until you called dogs.GetEnumerator(). This function was never defined. What does GetEnumerator() actually do? Where's the implementation?

  • @Mike-tb9xq
    @Mike-tb9xq Před rokem

    Why couldn't you just use shelter.dogs in your foreach loop?

  • @melone2848
    @melone2848 Před 2 lety

    Kartoffelsalat

  • @Gojam12
    @Gojam12 Před 2 lety

    too basic

  • @muhammedozalp
    @muhammedozalp Před rokem

    I am just at the beginning of the video. But please remove that weird animations if your target audience is not under 5 years old kids. They are so distracting.

  • @thomasjust2663
    @thomasjust2663 Před rokem

    The cartons and images seriously detract from the usefulness of the video, also by having the IDE do the work, you are actually are creating programmers who don't know truly what they are doing, thumbs down and I would recommend anyone from staying away from your courses