LINQ: How to retrieve an IEnumerable collection with simple query
This is a simple query in Linq to retrieve the list of Users that have some specified condition (in this case Active == true).
Please note the == operator in the where clause (and in general all C# operators apply).
Linq is excellent in writing fast and effective in-memory query on lists, dictionaries, etc.
post this code
ICollection<User> users = new List<User>();
IEnumerable<User> result = (
from user in users
where user.Active == true
If you want to be updated about similar snippets,
and follow our Channels