C# Queryable LongCount 方法
使用 Linq LongCount 方法獲取元素計數。
下面是我們的字串陣列 −
string[] emp = { "Jack", "Mark"};現在,使用 LongCount() 方法。
emp.AsQueryable().LongCount();
以下是完整程式碼。
示例
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);
}
}輸出
2 employees in the Department
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP