C# IEnumerable & IEnumerator

preview_player
Показать описание
IEnumerable and IEnumerator play an integral part in your day-to-day development, whether you know about them or not! They can also yield strange results if you don't know how they work.

In this video I'll show you what they do, how they work and how you can create your own enumerable classes.

=========

00:00 - Intro
00:20 - First example (Heroes of Olympus)
4:00 - Second example (Query behaviour / Random)
6:16 - ToList() tradeoffs - pros & cons
8:03 - ToList() example
9:24 - Example benchmark
11:33 - IDE love
13:30 - One at a time
16:45 - Linq benefits on IEnumerables
18:00 - Custom IEnumerator
21:41 - Generic IEnumerator for Linq queries
23:56 - Summary
Рекомендации по теме
Комментарии
Автор

This is very good content. Most YT creates are just recreating beginner tutorials. We need more intermediate-advanced content like these. Thank you.

SandeepKumarP
Автор

Would like you see a video about multithreading in c# and unity. Also when to use a new thread or when not to. This would be a nice addition to this video (that's beautiful and detailed btw 😉)

moritzscheuerle
Автор

Hey Taro, you're the latest developer I've started watching on YouTube, and your content and technical level is a testament to how much I've grown developing. Your async video showed me that there's a world of techniques and skills I haven't even heard of and that's a great motivation, Thanks!

I'd love to see a video about the process you go through when tackling a new project, specifically the design of the arquitecture of code that is done before one sits down and starts coding. I've been taught the benefits of getting good at thinking in a modular way and assigning roles to my components beforehand and it is a skill that has boosted my development time immensely, I usually design a quick prototype, code it, and then go back to the whiteboard(shout-out to Milanote) to design a fleshed out arquitecture/system for my project.
Keep on rocking!

ITSJTG
Автор

Hi Taro! I don't want the licenses, I just want to say I love what you do. For a long time I've been looking for a channel like yours, a non beginner, intermediate level tutorials to take my development a step higher. Even if I know the topic, I always learn something new from your videos. Thanks for making them available for free and congrats on the sponsorship.

Tharky
Автор

How does this channel not have more subscribers and views? Amazing content, man.
Thank you for all you give to the community.

jameslavery
Автор

Love seeing Linq Love. Would love to see a video on Custom Editors for Unity. Still new to the channel but so far definitely a new favorite of mine.

JoshuaVillarreal
Автор

Love the fact that you not only do Unity specific content but also go into more advanced C# functions,
it really helps thinking of some solutions for a couple of my problems.
I dont necessarily have a request for a videos I just enjoy your content and your take on some functions.

JoschinoDev
Автор

Really well explained Sir! Thanks a bunch!

babakiani
Автор

Dude! I'm so jealous! Gratz on the sponser. I love Idea and I wish I could use Rider. My plan was actually to try to grow on YouTube until I can get into the partner program with them. I'd love to get a license but I'm damn cheap. I actually just put out a video of my own, where I shouted you out for the Async/Await video.

BTW I am blown away you only have just under 9k subs.

SkylorBeck
Автор

Really learned something new today. Also, my suggestion for the next video would be a video about multithreading. There are very few videos that are actually informative and teaches you stuff on YouTube about multithreading and when to or not to use threads. I have always been curious on how to implement it efficiently. Also would love to have that rider license 💜

NotElayn
Автор

Your Unity/C# content is literally awesome. Thank you for your videos and the work you put into this!

kathleenbryan
Автор

I have commented on your channel afew months ago to learn, now I got my games in 2D &3D running, thank you for sharing ☺

NHGeneral
Автор

Another great video as always! Loved learning about the internal optimization that Linq does with IEnumerables; was surprised it didn't first take three.
I'd be keen to see a short & sweet video about the differences between heap vs stack, intuitive analogies, and some practical examples and considerations between using one over the other.
Awesome to see you getting sponsored! You've earned it! <3

libberator
Автор

I couln't understand the concept half year ago, I guess I didn't have enough context around the language, but now by re watching this video I started to get it, thank you for the wonderful and clear tutorial !! And I've used Rider for nearly one month, it's fantastic !

qiangpanchen
Автор

Just finished the video, thank you so much for breaking it down into digestible chunks! I'm really enjoying your style on YouTube, you've filled the Brackeys size hole in my heart and then some lol If possible, would you be up to doing a video on delegates? Specifically Action and Func and how they can be used to pass information around your game? There are other videos, but they kinda expect you to have a solid grasp on delegates in general. I'd love to get a license key too, hopefully I'm lucky lol

Pengisman
Автор

I think videos like this are required more, as most guides online focus on beginner/lower intermediate side of things with the occasional bad practice, but easy to implement approach, whereas this ventures into general optimisations and correct use cases for pretty common actions.

More videos of this kind, leaning more into advanced topics are a good stepping stone for junior developers to lean into.

ElegantWaster
Автор

Lovely and very informative, I have been using IEnumerator for some time and I had no idea about these... Thank you for sharing your knowledge on these... The one I would like to learn in the future is accessing the explorer from the application mobile/windows/mac and saving and loading the files in the Android or iOS

xarcader
Автор

If people are interested in it, I back-ported some .NET 5 - 7 features to old Framework 4.X and Standard 2.X runtimes (so it can be consumed in Unity properly) that makes List<T> iteration between 3 to 5x faster and absolutely crushes the regular "foreach" and "for" loop patterns. I've been thinking of making a video about it, although it is a very advanced subject involving IL assembly language and low-level rules and behaviors of .NET/Mono runtimes. Actually using the DLL I created to iterate Lists faster is super easy though, anyone can use it and it barely changes anything in your code, it is just the technical details of how it was done to bring the feature to older runtimes that's really esoteric and advanced stuff that I'm not sure people would watch ...

By the way, Taro, instead of "List<T> list = new List<T>() { ... };", or using the var keyword as most people do, I've found it's much, much cleaner and more readable to do this:

List<T> list = new() { ... };

In C# 10 you don't need to repeat the type name twice on both sides of the expression, just once on either side (the right-hand side for var assignment, the left-hand side for the new() assignment). It's really nice because it's super easy to refactor and cuts down on typing, so you get the succinct, short-handedness of the var keyword, the clarity of explicitness and a greater level of refactorability/flexibility you don't otherwise get.

GameDevNerd
Автор

This was awesome. Definitely did NOT know about the multiple enumeration issue. You sir, are a legend.

bourbonbristles
Автор

Very nice IEnumerable video, a lot of junior programmers that start working with me ask about Linq stuff.
Unfortunately I'm pretty busy very often so it's nice to have video like that to share with them and show the basics.
I would love to see more Linq usage and explanations videos in the future.

ZbigniewCebulaDev