Csharp/C Sharp/LINQ/Enumerable — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 14:38, 26 мая 2010
Use static method syntax to call the query operators.
<source lang="csharp"> using System; using System.Collections.Generic; using System.Linq; public class MainClass {
public static void Main() { string[] names = { "J", "P", "G", "Pa" }; IEnumerable<string> filtered = Enumerable.Where(names,n => n.Contains("a")); IEnumerable<string> sorted = Enumerable.OrderBy(filtered, n => n.Length); IEnumerable<string> finalQuery = Enumerable.Select(sorted,n => n.ToUpper()); }
}
</source>