DEV Community

Cover image for Yield Return Explained !

Yield Return Explained !

Ahmed Adel on August 19, 2021

Yield keyword has always been a highly misunderstood keyword in C#, so I will try to explain it with a simple example so hopefully you can understa...
Collapse
 
bellonedavide profile image
Davide Bellone

What a great article! :) Great job, Ahmed!

Collapse
 
ahmedadel profile image
Ahmed Adel

Thanks, Davide.. Happy to hear that :)

Collapse
 
xre profile image
PetteriPertola

I have a question about your Benchmarking here. According to your result you only allocated 226 KB of Memory... but how is that possible when you created effectively 1 million new student objects? Even if they were 1 byte each you would still allocate 1 megabyte. Seems unlikely you could allocate only 226 kB?

Collapse
 
johnplz profile image
Ioannis Michail

Thank you! Very good article :)

Collapse
 
ahmedadel profile image
Ahmed Adel

Thanks al lot

Collapse
 
pobx profile image
Pobx

Thank you for a great article.

Collapse
 
ahmedadel profile image
Ahmed Adel

Thanks Pobx 😁

Collapse
 
maboukaff profile image
Mohamed AbdAllah

Great job bro. It's really valuable.

Collapse
 
ahmedadel profile image
Ahmed Adel

Thanks, Mohamed . This is so much appreciated

Collapse
 
blowin profile image
blowin

At least it was worth specifying capacity)

Collapse
 
murilobdo profile image
Murilobdo

great article <3

Collapse
 
ahmedadel profile image
Ahmed Adel

Thanks, Murilobdo.. Happy to hear that :)

Collapse
 
ayodejii profile image
Isaac Ayodeji Ikusika

great article. 🚀

Collapse
 
prantzos profile image
Vasilis Prantzos

The explanation and presentation are so simple and easy to follow! Kudos! Many thanks!