Showing posts with label Use of long count in LINQ. Show all posts
Showing posts with label Use of long count in LINQ. Show all posts

Saturday, 13 July 2013

Use of long count in LINQ

Written By:-Isha Malhotra 
Our Website:-www.techaltum.com
Use of long count in LINQ

Long count is similar to count as it works same but the only difference between them is that long count returns a 64 bit integer.

For Example:-

int[] marks = new int[] { 23, 45, 78, 90, 56, 89, 10, 32 };

      Int64 res = marks.LongCount(x => x % 2 == 0);
                        OR
long res_long = marks.LongCount(x => x % 2 == 0);
       Response.Write(res_long);

The output of this code will be 5.