Answer Posted / puneet meena
while(get_next_record_from_database)
{ yield return your_next_record;}
It allows you to quickly create an object collection (an Enumerator) that you can loop through and retrieve records. The yield return statement handles all the of the code needed to create an enumerator for you.
The big part of the yield return statement is that you don't have to load all the of the items in a collection before returning the collection to the calling method. It allows lazy loading of the collection, so you don't pay the access penalty all at once.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the properties of ADO.NET?
Differences between namespace, class, assembly?
Which dll translate xml to sql in internet information server (iis)?
What is the difference between function and stored procedure?
What are the purposes of using .net?
Which namespace is require to used XML in .NET?
Explain the difference between public and static modifiers?
What is garbage collection and how it works. Provide a code example of how you can enforce garbage collection in .net?
Explain memory-mapped files.
How viewstate is being formed and how it is stored on client in .net?
Tell us what is a sealed class?
What is a metadata in .net?
Explain the use of activex control in .net?
What is the use of system.diagnostics.process class in .net?
Can "this" be used within a static method?