C# IEnumerator

  Рет қаралды 35,062

Jamie King

Jamie King

Күн бұрын

Пікірлер: 30
@TheDmitryIgorevich
@TheDmitryIgorevich 9 жыл бұрын
Brilliant! I could not find this explanation anywhere else!
@jvsnyc
@jvsnyc 5 жыл бұрын
Maybe if I understood the yield return idiom better already, or if I understood the foreach ( ) semantic better, I would agree that this goes without saying. But, coming from C++ where you can and do use the equivalent of foreach(), there called for() just to be different I suppose -- you can use that foreach() equivalent for write access to a container or range of values. So....if this foreach thing gives readonly access to something, it is the kind of thing one would hope to be pointed out. 26 times out of 27, these videos give interesting and illuminating details that others leave out. In this case, this dandy sentence would have been helpful to introduce this topic, at least to people who are mostly used to C/C++: "IEnumerable is an interface that defines one method: GetEnumerator() which returns an IEnumerator interface, which allows readonly access to a collection." Okay, I lied, I like his next few sentences too: "IEnumerable is some type that you can loop thru. It is read only. If you just need only to read, sort or filter your collection, IEnumerable is what you need." This is pretty different than C, which has no foreach equivalent and no iterators of any type, and C++ which considers readonly iterators a special class of their own, and let's its foreach (for) have either read or write access to whatever it iterates over. I think I even understand why the readonly obsession, you can use IEnumerable to loop thru a bunch of values that aren't coming from a collection at all, but say, but are getting received from somewhere else for instance, being randomly spat out by logic or even Random.next() invocations... To my shame, at the moment I can't remember if Java's foreach and iterators are readonly like this or give you options like C++ to write to the place you are iterating over.
@ivandrofly
@ivandrofly 11 жыл бұрын
Man you have the best video tutorial I've seen on KZbin #JamieKing #computerscience #csharp
@judith2203
@judith2203 6 жыл бұрын
Excited to see more of your work to assist me with my studies. Great video man
@KamillaMirabelle
@KamillaMirabelle 7 жыл бұрын
The IEnumerator does not only take linear ordet collection, and thats is a difference between indexing and IEnumerator. let say that we have a collection that is of a tree structure, or a even more complex structure. then you need to give C# an method to go through the collection in an ordet maner. That's why C# maked the IEnumerator interface :)
@streambai5656
@streambai5656 4 жыл бұрын
You are so great! You should add more videos!
@jamesleo1498
@jamesleo1498 7 жыл бұрын
I like this video. It clarified some things for me. Would you be so kind as to talk about how the GetEnumerator() method returns the IEnumerator interface which seems to be almost like a collection of objects itself? Hopefully that question makes sense.
@oguzhanozhan
@oguzhanozhan 11 жыл бұрын
i have ti admit,,sometimes i am saying, what the heck is he talking about:) but at the end ..i am saying..oohh yeah...You are doing a great job Mr. King..Thanks:)
@connorhatcher2202
@connorhatcher2202 5 жыл бұрын
Simple explanation, great tutorial.
@47Mortuus
@47Mortuus 4 жыл бұрын
Unfortunate that the entire 37 video "C# containers" playlist only consists of arrays.
@jimmynguyen7961
@jimmynguyen7961 5 жыл бұрын
Exactly the explanation I was looking for. Thank you!
@stevancosovic4706
@stevancosovic4706 3 жыл бұрын
Great video, thanks!
@Геннадій-ц8э
@Геннадій-ц8э 6 жыл бұрын
That is great as well as funny to listen )) Thank you!!!
@ivandrofly
@ivandrofly 11 жыл бұрын
Thank you Mr. King :)
@evilnekowantznobs
@evilnekowantznobs 6 жыл бұрын
Damn do I love these tutorials.
@vladajamajka
@vladajamajka 8 жыл бұрын
Thanks mate! You rock!
@JamieKingCS
@JamieKingCS 8 жыл бұрын
+Vlada Karovic Yep! Glad it helped you!
@Jointknight
@Jointknight 6 жыл бұрын
Awesome again!!!
@IroshanVithanage
@IroshanVithanage 6 жыл бұрын
On point... Thanks :)
@seanshimon
@seanshimon 9 жыл бұрын
Thanks a lot man.
@aboutvenice
@aboutvenice 6 жыл бұрын
nice! thx
@mazdysoraya6121
@mazdysoraya6121 11 жыл бұрын
Great. Shared.
@atlantichollywoodentertain650
@atlantichollywoodentertain650 8 жыл бұрын
So I was playing with this so I could get a good understanding of it and I tried iterating through a list of objects that I made call "Employees". I tried using my my iteration reference variable **IEnerator tryIEnum = employList.GetEnumerator()** to retrieve a property of one of the objects **tryIEnum.Name** but it didn't work. I am not sure if I am understanding this.
@JamieKingCS
@JamieKingCS 8 жыл бұрын
+ATLANTIC HOLLYWOOD ENTERTAINMENT tryIEnum.Value.Name
@atlantichollywoodentertain650
@atlantichollywoodentertain650 8 жыл бұрын
+Jamie King Thanx man. when I tried **tryIEnum.Current.Name** I was able to retrieve the property value.When Console.WriteLine() the **tryIEnum** I get **System.Collections.Generic.List blah blah blah**
@seven.0158
@seven.0158 8 жыл бұрын
Stupid question but ....... why can't I write Console.writeline (myPartyAges[1]); ? or do a for (.......... ?
@JamieKingCS
@JamieKingCS 8 жыл бұрын
+Ricard Hagerman You can... ?
@seven.0158
@seven.0158 8 жыл бұрын
+Jamie King just wait for a few videos, was missing the indexer thx
@PodcastClips1212
@PodcastClips1212 6 жыл бұрын
i don't understand why you don't use the name Ola
C# IEnumerator Example
14:39
Jamie King
Рет қаралды 12 М.
Implementing IEnumerable
17:35
Coding Tutorials
Рет қаралды 11 М.
Flipping Robot vs Heavier And Heavier Objects
00:34
Mark Rober
Рет қаралды 60 МЛН
Perfect Pitch Challenge? Easy! 🎤😎| Free Fire Official
00:13
Garena Free Fire Global
Рет қаралды 15 МЛН
黑的奸计得逞 #古风
00:24
Black and white double fury
Рет қаралды 29 МЛН
Advanced Breakpoints and Tracepoints in C#
22:36
IAmTimCorey
Рет қаралды 3,9 М.
IEnumerable and IEnumerator Interface in C#
13:58
DotNetSkoool
Рет қаралды 25 М.
C# IComparable
8:14
Jamie King
Рет қаралды 31 М.
"Clean" Code, Horrible Performance
22:41
Molly Rocket
Рет қаралды 902 М.
Object-Oriented Programming is Embarrassing: 4 Short Examples
28:03
C# IEnumerable & IEnumerator
25:15
Tarodev
Рет қаралды 35 М.
IEnumerable 🆚 IEnumerator Interfaces in C#
34:06
tutorialsEU
Рет қаралды 29 М.
The Path to C# in 2024
1:03:41
IAmTimCorey
Рет қаралды 98 М.
C# GetEnumerator - Introduction
6:12
THEENK
Рет қаралды 2,8 М.