What is Long Count

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.

Example of Long Count

		
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.

Similarly we can apply this on generics, and database too.

On Generics:-

  List<data> dt = new List<data>()
        {
            new data{roll_no=1, student="isha", per=100},
            new data{roll_no=2, student="sneha", per=89},
            new data{roll_no=3, student="rahul", per=34},
            new data{roll_no=4, student="renu", per=34},
            new data{roll_no=5, student="sapna", per=89}
        };

        Int64 count_res = dt.LongCount(x => x.per > 50);





On Database:-

  Int64 res_count = dc.GetTable<Class1>().LongCount(x => x.id > 8);

		
		

Email Address

For any query you can send mail at info@techaltum.com
Thanks