by
4,839 33
0
5
2,639
1
Top 1% !
Popular
Famous
Specified
Refined
Popularity: 5029th place
Created
Modified Sep 27, 2013
This snippet is Public
No tags for this snippet yet.
.NETFramework4.0
Architecturex86_64
Extension.cs
LanguageCSharp
LicenseMIT_X11
OSWindows
Windows VersionWindows7

Filtered COUNT (*) in Linq

This is a very effective method to count in-memory a given collection (Users), with an established filter (active == true).
Really fast, really simple, Linq style!!
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/11258/Filtered-COUNT-(-)-in-Linq?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
(from user in Users where user.Active == true select user).Count();
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus