2014-05-21

LINQ Query Expressions (C# Programming Guide)

LINQ declarative query syntax

Language-Integrated Query (LINQ) is the name for a set of technologies based on the integration of query capabilities directly into the C# language (also in Visual Basic and potentially any other .NET language). With LINQ, a query is now a first-class language construct, just like classes, methods, events and so on. By using query syntax, you can perform even complex filtering, ordering, and grouping operations on data sources with a minimum of code. You use the same basic query expression patterns to query and transform data in SQL databases, ADO.NET Datasets, XML documents and streams, and .NET collections.

http://msdn.microsoft.com/en-us/library/bb397676.aspx

Query Keywords (C# Reference) for LINQ declarative query syntax

http://msdn.microsoft.com/en-us/library/bb310804.aspx


Query Syntax and Method Syntax in LINQ (C#)

Most queries in the introductory Language Integrated Query (LINQ) documentation are written by using the LINQ declarative query syntax (see above). However, the query syntax must be translated into method calls for the .NET common language runtime (CLR) when the code is compiled. These method calls invoke the standard query operators, which have names such as Where, Select, GroupBy, Join, Max, and Average. You can call them directly by using method syntax instead of query syntax.

http://msdn.microsoft.com/en-us/library/bb397947.aspx


IEnumerable vs IQueryable

http://www.codeproject.com/Articles/766541/IEnumerable-vs-IQueryable

Most commonly we use the IEnumerable interface and we do not even notice that there is also another interface known as the IQueryable. The article link above provides a good overview of the difference between the two. In short, for better efficiency, you may want to use the IQueryable and call AsQueryable() to convert from a List.






No comments:

Post a Comment

Github CoPilot Alternatives (VSCode extensions)

https://www.tabnine.com/blog/github-copilot-alternatives/