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

Explain assemblies in .net?

1030


Explain me what is encapsulation?

998


Explain the difference between .net 2000 and .net 2005(features)? Which one is better?

962


What is view state in .net?

969


What is the purpose of IClonable interface in .NET?

994


Explain what is reflection in microsoft .net context?

1078


What is Event Bubbling in .NET?

1052


What are the core differences between .NET Languages ?

2275


Can you explain what do you understand about web service?

1046


Tell us what is heap and what is stack?

1055


Tell me about secure socket layer? How to make use of the technology?

928


Explain the difference between public and static modifiers?

1085


Do you know what are three common acronyms used in .net, and what do they stand for?

953


What is WSDL? Explain its architecture?

1108


Interop Services?

1894