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
Is it true that objects don't always get destroyed immediately when the last reference goes away?
Explain when should you use .net web forms over asp.net mvc?
Explain webfarm vs webgardens in .net?
what are connection strings?
What is a design pattern and what is it for?
Explain about .net?
What is the use com component in .net?
Explain how com+ related to the dna architecture?
Explain what is an interface and what is an abstract class? Please, expand by examples of using both. Explain why?
Explain difference between panel and groupbox classes using .net?
What are the improvements made in cas in .net 4.0?
Is there built-in support for logging?
Explain the difference between asp.net & vb.net and explain architecture?
Define code access security (cas)?
A developer company sends dlls to the client. Some client is not happy current functionality, so request some modification. Developer made some changes and send new dll to all clients. Some client is happy with old version, tell me minimal change to so that neither clients get affected?