IEnumerable 🆚 IEnumerator Interfaces in C#

Поділитися
Вставка
  • Опубліковано 3 жов 2024
  • 🚀 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

КОМЕНТАРІ • 41

  • @tutorialsEU
    @tutorialsEU  3 роки тому +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/

  • @gazell3s
    @gazell3s 3 роки тому +9

    Super clear explanation - exactly what I needed!

  • @lowkeyhuman
    @lowkeyhuman 2 роки тому +6

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

  • @dayday8421
    @dayday8421 3 роки тому +1

    Best explanation on UA-cam. Thank you!

  • @simonroyjonesuk
    @simonroyjonesuk Рік тому

    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

  • @angel_machariel
    @angel_machariel Рік тому +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?

  • @juniorlucival
    @juniorlucival 2 роки тому +1

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

  • @bryanburger
    @bryanburger 2 роки тому +1

    Great job at conveying the principles!

  • @oaksoeaung7646
    @oaksoeaung7646 6 місяців тому

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

  • @FumeCreates
    @FumeCreates 3 роки тому +1

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

  • @Issam_seb
    @Issam_seb 2 роки тому

    Clean and Simple

  • @carlossantamaria1820
    @carlossantamaria1820 2 роки тому

    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.

  • @BackeB
    @BackeB Рік тому

    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 😁

  • @siestitrokot3843
    @siestitrokot3843 3 роки тому

    Great demo! Thank you!

  • @andrewfedorov9198
    @andrewfedorov9198 Рік тому

    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?

  • @Gojam12
    @Gojam12 3 роки тому

    Good practical and usable explanation

  • @heshamabdo6024
    @heshamabdo6024 2 роки тому

    Thank you so much for this video

  • @Javier-uh7mb
    @Javier-uh7mb 3 роки тому +1

    Very interesting, thanks!

  • @DanFlakes
    @DanFlakes 3 роки тому

    Thanks for clearing it up!

  • @shubhangimane8556
    @shubhangimane8556 3 роки тому +1

    nice video

  • @RealityCheck6T9
    @RealityCheck6T9 2 роки тому

    Good video thanks

  • @oblivion3799
    @oblivion3799 3 роки тому

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

  • @nikolazagorac8634
    @nikolazagorac8634 Рік тому

    Great video, why can't I save it?

  • @andreashecht272
    @andreashecht272 3 роки тому +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 2 роки тому

      i have the same question in my head

  • @ВалентинГандрибіда2пі-23б

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

  • @danielbereketsiyum825
    @danielbereketsiyum825 Рік тому

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

  • @TheKr0ckeR
    @TheKr0ckeR 2 роки тому

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

  • @youtischia
    @youtischia 2 роки тому

    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 2 роки тому

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

  • @stbny4444
    @stbny4444 2 роки тому

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

  • @malcox5218
    @malcox5218 3 роки тому

    7:38

  • @Mike-tb9xq
    @Mike-tb9xq 2 роки тому

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

  • @melone2848
    @melone2848 2 роки тому

    Kartoffelsalat

  • @thomasjust2663
    @thomasjust2663 Рік тому

    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

  • @muhammedozalp
    @muhammedozalp 2 роки тому

    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.

  • @Gojam12
    @Gojam12 3 роки тому

    too basic