C# LINQReview extension methods from the System.Linq namespace. Learn to write queries directly in programs.
LINQ. The bird calls out in search of a mate. It queries the surrounding area with its bird song. With LINQ we formulate queries in our programs.
The Enumerable type has some useful static methods. If you need an IEnumerable collection of a range or a repeated element, consider Range or Repeat.Range, Repeat, Empty
This is a special syntax form in C#. We can call a method on a variable like it is an instance method. But it is not on the class. It is specified in a separate place.Extension
Notes, syntactic sugar. LINQ can be seen as a form of syntactic sugar. Queries could be written with for-loops. But when a program is easier to read and write, often it is better.
In query languages, we express what we want, not how it is to happen. The query language, not the programmer, is concerned with the exact implementation details.
Quote: We call this language the query language, because it is very useful for retrieving information from data bases by formulating queries, or questions, expressed in the language (Structure and Interpretation of Computer Programs).
A summary. LINQ is a powerful feature. Its methods and query expressions often improve the readability of programs. And they sometimes lead to new, delayed, superior algorithms.
© 2007-2020 Sam Allen. Every person is special and unique. Send bug reports to email@example.com.