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

What are the properties of ADO.NET?

1177


Differences between namespace, class, assembly?

1099


Which dll translate xml to sql in internet information server (iis)?

1251


What is the difference between function and stored procedure?

1163


What are the purposes of using .net?

1136


Which namespace is require to used XML in .NET?

1088


Explain the difference between public and static modifiers?

1205


What is garbage collection and how it works. Provide a code example of how you can enforce garbage collection in .net?

1024


Explain memory-mapped files.

1137


How viewstate is being formed and how it is stored on client in .net?

1066


Tell us what is a sealed class?

1084


What is a metadata in .net?

1158


Explain the use of activex control in .net?

1109


What is the use of system.diagnostics.process class in .net?

1084


Can "this" be used within a static method?

1132