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 me what is .net web service?

1050


what is dotnet architecture? can anyone explain that.

4410


What do you mean by Code Access Security in .NET?

1186


Please explain what is the difference between encrypting a password and applying a hashing?

977


How to manage pagination in a page using .net?

1007


How do you define the lease of the object in .net?

1001


What is "common language specification" (cls) in .net?

1002


What is .net standard?

1217


When we use windows api in .net is it managed or unmanaged code?

1091


Explain about .NET services?

1069


What are the core differences between .NET Languages ?

2390


Is Driver Script any how related to AOM?

1172


State the differences between the dispose() and finalize().

1039


What are data types in .NET?

1161


What is il in vb.net?

1031