Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
C# Queryable LongCount Method
Use the Linq LongCount method to get the count of elements.
The following is our string array −
string[] emp = { "Jack", "Mark"};
Now, use the LongCount() method.
emp.AsQueryable().LongCount();
Here is the complete code.
Example
using System;
using System.Collections.Generic;
using System.Linq;
class Demo {
static void Main() {
string[] emp = { "Jack", "Mark"};
long res = emp.AsQueryable().LongCount();
Console.WriteLine("{0} employees in the Department", res);
}
}
Output
2 employees in the Department
Advertisements
