
Code:
To count the number of elements in the sequence.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LINQ
{
class Program
{
static void Main(string[] args)
{
DataClassesDataContext dc = new DataClassesDataContext();
int empCount = (from emp in dc.EmpDetails
select emp).Count();
Console.WriteLine(empCount);
Console.Read();
}
}
}
Alternate Method:
DataClassesDataContext dc = new DataClassesDataContext();
int empCount = dc.EmpDetails.Count();
Console.WriteLine(empCount);

Join the conversation! Your thoughts help the community grow.