Brilliant! I could not find this explanation anywhere else!
@jvsnyc5 жыл бұрын
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.
@ivandrofly11 жыл бұрын
Man you have the best video tutorial I've seen on KZbin #JamieKing #computerscience #csharp
@judith22036 жыл бұрын
Excited to see more of your work to assist me with my studies. Great video man
@KamillaMirabelle7 жыл бұрын
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 :)
@streambai56564 жыл бұрын
You are so great! You should add more videos!
@jamesleo14987 жыл бұрын
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.
@oguzhanozhan11 жыл бұрын
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:)
@connorhatcher22025 жыл бұрын
Simple explanation, great tutorial.
@47Mortuus4 жыл бұрын
Unfortunate that the entire 37 video "C# containers" playlist only consists of arrays.
@jimmynguyen79615 жыл бұрын
Exactly the explanation I was looking for. Thank you!
@stevancosovic47063 жыл бұрын
Great video, thanks!
@Геннадій-ц8э6 жыл бұрын
That is great as well as funny to listen )) Thank you!!!
@ivandrofly11 жыл бұрын
Thank you Mr. King :)
@evilnekowantznobs6 жыл бұрын
Damn do I love these tutorials.
@vladajamajka8 жыл бұрын
Thanks mate! You rock!
@JamieKingCS8 жыл бұрын
+Vlada Karovic Yep! Glad it helped you!
@Jointknight6 жыл бұрын
Awesome again!!!
@IroshanVithanage6 жыл бұрын
On point... Thanks :)
@seanshimon9 жыл бұрын
Thanks a lot man.
@aboutvenice6 жыл бұрын
nice! thx
@mazdysoraya612111 жыл бұрын
Great. Shared.
@atlantichollywoodentertain6508 жыл бұрын
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.
@JamieKingCS8 жыл бұрын
+ATLANTIC HOLLYWOOD ENTERTAINMENT tryIEnum.Value.Name
@atlantichollywoodentertain6508 жыл бұрын
+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.01588 жыл бұрын
Stupid question but ....... why can't I write Console.writeline (myPartyAges[1]); ? or do a for (.......... ?
@JamieKingCS8 жыл бұрын
+Ricard Hagerman You can... ?
@seven.01588 жыл бұрын
+Jamie King just wait for a few videos, was missing the indexer thx