Skip to main content

Posts

Showing posts with the label linq lambda expression query

"How to Use" IEnumerable and IQueryable [IEnumerable vs. IQueryable]

Both the IEnumerable and IQueryable interfaces are for . NET collections, so if you are new please see this article  and t he IQueryable interface inherits from IEnumerable interface, so whatever IEnumerable can do, IQueryable can also do. The IQueryable   interface   is the same as IEnumerable   interface    but it also provides additional functionality to implement custom querying with LINQ. Stayed Informed - IEnumerable vs. IList There are some differences over the interfaces IEnumerable and IQueryable as given below. IEnumerable :- The IEnumerable <T> interface exists in the namespace “ System.Collections ”. The IEnumerable <T> represents a forward only cursor of T . The IEnumerable <T> interface is fit for querying data from in memory collections like Array , List , and collations etc. While us querying data from the database. The IEnumerable executes SELECT Query on the server side, load list o...

LINQ Advantages and Disadvantages in .Net

The LINQ is stands for Language Integrated Query and it is a Microsoft .NET Framework component and use for data querying and it was released in .NET Framework 3.5 on November 19, 2007. The advantages and disadvantages for LINQ (Microsoft .Net) as give below in the details, Advantages 1.       It is quick turnaround for development. 2.       It is helps us to access any type of resource. 3.       It is a cleaner and type-safety. 4.       Lambda expressions are awesome. I am so happy to use it and I always recommended to others developers to use it. 5.       LINQ to SQL allows for RAD with database very nicely. 6.       Queries can be dynamically 7.       Declarative approach makes queries easier to understand and more compact. 8.       Extensibility and expression...

LINQ Lambda Expression query with Examples

A Lambda expression is an anonymous function that we can use to create expression tree types, delegates etc. A lambda expression is an expression on the right side of the => operator is called an expression lambda. It is also called (=>) goes to operator. Syntax:  (Input parameters) => Expirations or Statement block A Lambda expression is particularly helpful for writing LINQ query expressions. A lambda expression is powerful, shorter and suitable tool. Personally, I prefer to lambda extensions for most code writing. I am only using the statements if I am doing LINQ to SQL otherwise I am trying to emulate SQL. I find that the lambda methods flow better with code whereas the statements are visually distracting. So, here I am trying to explain gather T-SQL queries along with their LINQ queries with lambda expressions. EmpEntites empEnt = new EmpEntites();   //This is entities objects. In these entities objects, we have a table “ t...