LINQ and Count Extension Method

I have a database table that can contain many records, and I would like to calculate the current amount in the table. I was going to make simple:

DataContext.Table.Count(c => c.condition); 

Until I realized that the return type for Count is int . What if the table should contain more values ​​than can be represented in 32 bits? How can I count them?

Should I count them differently when we talk about such a scale?

+6
c # linq-to-sql
source share
2 answers

Use LongCount (), the same, but with a result of 64 bits.

+10
source share

My solution was to use the extension method .LongCount() .

0
source share

All Articles