Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is yield keyword in .Net?

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


Please Help Members By Posting Answers For Below Questions

Is it true that objects don't always get destroyed immediately when the last reference goes away?

1000


Explain when should you use .net web forms over asp.net mvc?

990


Explain webfarm vs webgardens in .net?

1072


what are connection strings?

2211


What is a design pattern and what is it for?

1050


Explain about .net?

1047


What is the use com component in .net?

971


Explain how com+ related to the dna architecture?

994


Explain what is an interface and what is an abstract class? Please, expand by examples of using both. Explain why?

1031


Explain difference between panel and groupbox classes using .net?

1021


What are the improvements made in cas in .net 4.0?

952


Is there built-in support for logging?

1050


Explain the difference between asp.net & vb.net and explain architecture?

980


Define code access security (cas)?

995


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?

924