Back
Close

What is yield return in C#?

gpeipman
28.7K views

Yield return in C#

Yield return in C# language feature that allows us to write shorter methods that operate on collections. Demo below shows how with yield return we don't have to define collection or list that holds elements returned by method.

Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io