I am very new in LINQ
I have written following query :
var duplicate =
from loginId in DataWorkspace.v2oneboxData.me_employees
where loginId.me_login_name == this.me_login_name
&& loginId.me_pkey != this.me_pkey
select loginId;
I want to count the rows returned in the result duplicate
I searched many of articles that says use duplicate.Count(). but i dont see count() in my intelisense
how do i count from result
If you're using lambda expressions then make sure you have referenced System.Linq.Expressions
namespace.
var cardCount = datatable
.AsEnumerable()
.Where(p => p.Field<decimal>("SpotID") ==
Convert.ToDecimal(currentActivatedSpot))
.Count();
How about doing it using extension methods:
var count = me_employees.Where(me => me.me_login_name == this.me_login_name && me.me_pkey != this.me_pkey).Count();
Even better:
var count = me_employees.Count(me => me.me_login_name == this.me_login_name && me.me_pkey != this.me_pkey);
BIG NOTE: Ensure that you have referenced System.Core. System.Data.Linq as well but I assume you already referenced it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With