Post

System.Ling

It seems to me that apart from test nothing else is needed for complete understanding.

tests: https://github.com/dotnet/runtime/tree/main/src/libraries/System.Linq/tests

The query should be executed in the database; this is more efficient to use compiled query: stored procedure. If there is no access to the server then you have to manipulate the data on the client.

additional: https://github.com/dotnet/try-samples/tree/main/101-linq-samples/src
full methods list:
Enumerable.cs
Queryable.cs

Selection

  1. Where.cs after ‘group by’ implements ‘having’
  2. Take.cs
  3. Skip.cs
  4. SkipWhile
  5. TakeWhile

Uniq selection

  1. Distinct.cs check through adding to Hashset

Selection of a single item

  1. First.cs
  2. FirstDefault
  3. Last
  4. LastDefault
  5. ElementAt.cs is not supported in LINQ to SQL
  6. Single.cs throw error if selection have several convinient records
  7. SingleDefault
  8. DefaultIfEmpty returns null or default(TSource) if the sequence has no elements

Aggregation, calculation

  1. Average.cs
  2. Count.cs
  3. LongCount
  4. Max.cs
  5. Min.cs
  6. Sum.cs
  7. MaxBy just for IEnumerable
  8. MinBy just for IEnumerable

Sorting

  1. OrderBy
  2. ThenBy sort records with same key after previous sorting
  3. OrderByDescending
  4. ThenByDescending
  5. Reverse

Transformation

  1. Aggregate.cs IEnumarable
  2. Select.cs option with index (m,i)
  3. IEnumarable<T> T another type of items
  4. Cast throw error
  5. ofType pass error during transformation
  6. SelectMany.cs one-to-many data is taken from the second table and transferred to the response

Qualifiers

  1. Contains.cs interchangable with Any
  2. Any interchangable with Conains
  3. All.cs

Interfaces

  1. Asenumerable doesn’t force immediate query execution
  2. AsQueryable

Grouping

  1. Grouping.cs
  2. GroupJoin.cs

Collection manipulation

  1. Join.cs LeftJoin with assistent DefaultIfEmpty()
  2. Concat.cs for first sequence come next one
  3. Union.cs uniq
  4. UnionBy
  5. Intersect.cs uniq intersection
  6. Except.cs uniq diffrence not exist, not in
  7. Chunk.cs [][]
  8. Zip.cs array of anonyme types

Compare

  1. SequenceEqual.cs

Add

  1. AppendPrepend.cs

Change a collection type

  1. ToArray
  2. ToDictionary
  3. ToCollection.cs
  4. ToList
  5. ToLookUp grouping records by arbitrary field of table
  6. ToHashSet

Generation

  1. Range.cs only for int. Static Enumerable
  2. Repeat.csonly for int
  3. Empty
This post is licensed under CC BY 4.0 by the author.