Skip to content
Branch: master
Find file History
BillWagner 101 linq samples (#41)
* checkpoint - switching machines.

* Restriction samples work

* refactoring the first samples

* Add the projection samples

This commit includes the second set of samples.

* checkpoint

* All the projection operators are done.

* Add partition samples.

* add ordering

This hasn't been fully tested yet.

* Update the ordering samples

Update the ordering samples so that this doesn't mix samples with a shared session with samples in different sessions.

* switching machines

* Add the grouping samples.

* switching machines.

* set operations are ready

* port conversions (not completed)

* conversions are complete

* add element operators

* add generators

* add quantifiers

* fix links.

* Finish the sample code.

* all samples done.

This is ready for a final review

* check all links

* Final proofread

And done.
Latest commit 72ebd64 Sep 21, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs 101 linq samples (#41) Sep 21, 2019
src 101 linq samples (#41) Sep 21, 2019 101 linq samples (#41) Sep 21, 2019

101 LINQ Samples

dotnet try Enabled

Learn how to use LINQ in your applications with these code samples, covering the entire range of LINQ functionality, demonstrating LINQ with objects. Once you've learned LINQ using object sequences, you can use LINQ with any supported data source.

Exploring LINQ using this tutorial

This tutorial starts with the fundamentals of LINQ. You can follow each page in order to explore all the elements of LINQ. Following step-by-step lets you explore LINQ from these fundamental queries through more complicated queries, up to the most complex uses.

Alternatively, if you're familiar with LINQ, you can jump to a specific section to refresh your knowledge, or learn new techniques. Here is the full list of samples:

Restriction operators: The where keyword

The where keyword or Where method provide this capability. These operators restrict, or filter, the input sequence to produce an output sequence.

Projection operators: The select keyword

The select keyword or Select method provide this capability. These operators create output sequence elements from input sequence elements. The output elements may be either the same or different types.

Partition operators

Use the Take, Skip, TakeWhile and SkipWhile methods to partition the input sequence. You can get a slice of the input sequence as the output sequence.

Ordering operators

The orderby keyword, along with descending, and the OrderBy, ThenBy, OrderbyDescending and ThenByDescending LINQ queries are used to sort data output.

Grouping operators

The GroupBy and into operators organize a sequence into buckets.

Set Operators

These operators provide functionality to compare multiple sets of data. You can find the intersection, union, all distinct elements and the difference between sets.

Conversion operators

Sometimes you want to convert a query result set to a different kind of collection. These operators show how you can do this.

Element operators

The methods First, FirstOrDefault, Last, LastOrDefault, and ElementAt retrieve elements based on the position of that element in the sequence.

Generate sequences

These methods generate sequences of integers.

Quantifying members

The methods Any and All test for elements that match a condition. Any checks for one element. All checks that all elements match the condition.

Aggregator operators

There are a number of methods that perform calculations on values in a sequence. Note that some of these methods require that the input sequence is a numeric type. Those methods are noted below.

Sequence operations

These methods operate on entire sequences rather than elements of a sequence. They compare sequences or create new sequences from combining all elements.

Eager and lazy query execution

You can use different query operations to specify eager execution instead of lazy execution.

Join operations

These operations perform similar functions to SQL join operators. These work with any LINQ data source.

You can’t perform that action at this time.