LINQ provides a common query syntax to query any data source. In a LINQ query, you always work with objects. The object might be in-memory of the program or remote object i.e. out memory of the program. Based on object, LINQ query expression is translated and executed.
There are two ways of LINQ query execution as given below:
Deferred Execution
In case of differed execution, a query is not executed at the point of its declaration. It is executed when the Query variable is iterated by using loop for, foreach etc.
DataContext.
Showing posts with label linq. Show all posts
Showing posts with label linq. Show all posts
Understanding Expression and Expression Trees

In .NET, Expression is an abstract class which contains static methods and inherited by various types (like ParameterExpression, MethodCallExpression, BinaryExpression etc.) to create expression tree nodes of specific types. Also all these expression-specific expression tree types are defined in System.Linq.Expressions namespace.
Expression Trees
Expression Trees was first introduced in C# 3.0 (Visual Studio 2008),.
Create xml from database using LINQ

XML data is often used to transfer data from one application to another. Since XML is language independent, hence it is a good choice to use xml for transferring data between two different platform applications. In C#, it is easy to make xml from database by using LINQ to SQL and LINQ to XML.
Create XML from Database
Suppose we have below table in database. Now I want to make xml of all the products which have stock greater than.