System.Linq.Enumerable
provides the standard query operators functionality for objects that implement System.Collections.Generic.IEnumerable<T>
. Enumerable
is implemented as static
methods. System.Collections.Generic.Dictionary<TKey, TValue>
object can be sorted (in SQL parlance: ordered by) by the value of the dictionary's entries rather than its keys. [System.Collections.Generic.Dictionary[String, Int]] $wordCount = new-object 'System.Collections.Generic.Dictionary[String, Int]' foreach ($item in 'three', 'four', 'four', 'two', 'four', 'three', 'one', 'two', 'four', 'three') { $wordCount[$item] = $wordCount[$item] + 1 } [System.Linq.Enumerable]::OrderBy( $wordCount, [Func[ System.Collections.Generic.KeyValuePair[String, Int] , # This is the type of $p in the next anonymous code block Int # This is tye type of what the anonymous code block returns ]] { param($p) $p.Value })
OrderBy
functionality. using System; using System.Linq; using System.Collections.Generic; class Prg { static void Main() { Int32 start = 12; Int32 count = 7; IEnumerable<Int32> range = Enumerable.Range(start, count); foreach (Int32 elem in range) { Console.WriteLine(elem); } } } // // 12 // 13 // 14 // 15 // 16 // 17 // 18 //
System.Linq.Queryable
class complements Enumerable
and provides standard query operators for obj that implement System.Linq.IQueryable<T>
.