Aggregation
Aggregate, Average, Count, LongCount, Max, Min, Sum
Conversion
AsEnumerable, Cast, OfType, ToArray, ToDictionary, ToList, ToLookup
Element
ElementAt, ElementAtOrDefault, First, FirstOrDefault, Last, LastOrDefault, Single, SingleOrDefault
ElementAt
ElementAtOrDefault
First (simple)
First (conditional)
FirstOrDefault
Last
LastOrDefault (simple)
LastOrDefault (conditional)
Single
SingleOrDefault
Generation
DefaultIfEmpty, Empty, Range, Repeat
Grouping
GroupBy
Join
GroupJoin, Join
Ordering
OrderBy, OrderByDescending, Reverse, ThenBy, ThenByDescending
OrderBy (simple - numbers)
OrderBy (simple - dates)
OrderBy (simple - objects)
OrderByDescending
Reverse
ThenBy
ThenByDescending
Other
Concat, SequenceEqual, Zip
Partitioning
Skip, SkipWhile, Take, TakeWhile
Projection
Select, SelectMany
Quantifiers
All, Any, Contains
Restriction
Where
Set
Distinct, Except, Intersect, Union
Close
SkipWhile: Skips elements in a collection while specified condition is met.
SkipWhile: Skips elements in a collection while specified condition is met. |
SkipWhile: Skips elements in a collection while specified condition is met. |
This Query Expression sample skips words in array, as long as word has length of 3 characters. |
This Query Expression sample skips words in array, as long as word has length of 3 characters. |
// A Query Expression cannot be constructed for SkipWhile() in C#. // Consider using a Lambda Expression instead.
' A Query Expression cannot be constructed for SkipWhile() in VB.NET. ' Consider using a Lambda Expression instead.
let Sample_SkipWhile_Linq() = let words = [| "one"; "two"; "three"; "four"; "five"; "six" |] let result = query { for w in words do skipWhile (w.Length = 3) } Debug.WriteLine(sprintf "Skips words while the condition is met:") for word in result do Debug.WriteLine(sprintf "%s" word)Output:
Skips words while the condition is met: three four five six
static void Sample_SkipWhile_Lambda() { string[] words = { "one", "two", "three", "four", "five", "six" }; var result = words.SkipWhile(w => w.Length == 3); Debug.WriteLine("Skips words while the condition is met:"); foreach (string word in result) Debug.WriteLine(word); }Output:
Skips words while the condition is met: three four five six
Private Shared Sub Sample_SkipWhile_Lambda() Dim words As String() = {"one", "two", "three", "four", "five", "six"} Dim result = words.SkipWhile(Function(w) w.Length = 3) Debug.WriteLine("Skips words while the condition is met:") For Each word As String In result Debug.WriteLine(word) Next End SubOutput:
Skips words while the condition is met: three four five six
let Sample_SkipWhile_Lambda() = let words = [| "one"; "two"; "three"; "four"; "five"; "six" |] let result = words.SkipWhile(fun w -> w.Length = 3); Debug.WriteLine(sprintf "Skips words while the condition is met:") for word in result do Debug.WriteLine(sprintf "%s" word)Output:
Skips words while the condition is met: three four five six