I had a table that contained a couple of columns defined in SQL 2005 as tinyint. In SQL, I’d generally write something like:
WHERE EmailOptIn = 1
Of course using LINQ there are lots of different ways to option the count. The simplest way is to use a Lambda Expression. Here’s what I came up with in VB.NET:
Translated in C#, it would be this:
db.Members.Count(p => p.EmailOptIn);
Hope that helps!