Csharp/C Sharp/LINQ/LongCount — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 18:31, 26 мая 2010
LongCount Prototype
<source lang="csharp"> using System; using System.Linq; using System.Collections; using System.Collections.Generic; public class MainClass {
public static void Main() { long count = Enumerable.Range(0, int.MaxValue).Concat(Enumerable.Range(0, int.MaxValue)).LongCount(); Console.WriteLine(count); }
}
</source>
LongCount with &&(and) operator
<source lang="csharp"> using System; using System.Linq; using System.Collections; using System.Collections.Generic; public class MainClass {
public static void Main() { long count = Enumerable.Range(0, int.MaxValue). Concat(Enumerable.Range(0, int.MaxValue)).LongCount(n => n > 1 && n < 4); Console.WriteLine(count); }
}
</source>