In this article I will demonstrate how to write code via IEnumerable and IQueryable and what the differences are between them.IEnumerable and IQueryable are used for data manipulation in LINQ from the database and collections.For getting the data from the database, I have created a table named "Employee" that has some data and looks like:Then creating the Data Context class (.dbml class) in your project that converts the database table named "Employee" as a class.Now I will tell you the functionality and some basic differences between IEnumerable and IQueryable using the object of the Data Context class..IEnumerable CodeSQL statement after execution of above queryAfter the execution of line number 18, the SQL statement will look like the following until the end:IQueryable CodeSQL statement after execution of the preceding queryAfter the execution of line number 22, the SQL statement will look like:But after the execution of line number 23, SQL statement will add the Top for the filtering.In both syntaxes I am accessing the data from the Employee table and then taking only 3 rows from that data. DifferencesIEnumerable
IQueryable
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: