score:-2
Accepted answer
Your linq query looks ok to me
public class Users
{
public string Username {get;set;}
public string Userid {get;set;}
}
void Main()
{
var users = new List<Users>{new Users {Username="johndoe",Userid="123"},
new Users {Username="stevejobs",Userid="456"}
};
var filter = users.Where(a => (a.Username.Equals("123") || a.Userid.Equals("123"))).ToList();
filter.Dump();
var filter2 = users.Where(a => (a.Username.Equals("456") || a.Userid.Equals("456"))).ToList();
filter2.Dump();
}
Source: stackoverflow.com
Related Articles
- Linq query and multiple where clauses with OR only first condition gets evaluated
- Entity Framework Core LINQ query with multiple where clauses
- How to Create a Linq Query with Multiple Conditional Where Clauses
- LINQ query with multiple conditional where clauses
- linq to entities query which has multiple where clause and one where clause with where in condition
- Left Outer join LINQ query with four entities in CRM 2011 and with multiple where clauses
- Multiple WHERE Clauses with LINQ extension methods
- linq to sql query with multiple where parameters
- LINQ query with a WHERE clause with multiple conditions
- Linq with where clause in many-to-many EF Code First object
- How to query by where clause with EF code first
- Linq filtering results with multiple Where clauses
- add where clauses to linq query with generic column name
- Linq sub query when using a repository pattern with EF code first
- Linq to Datatable with multiple where clauses
- Query with LINQ where Context matches multiple parameters from a List of Objects
- LINQ query with multiple conditions in WHERE clause
- linq to sql query with checkboxes where condition combination
- LINQ LEFT JOIN, Combine multiple WHERE clauses with OR
- C# LINQ multiple one to many includes with where condition
- Lambda LINQ query with multiple from clauses
- Linq query for distinct data from a table with where condition
- LINQ query - Multiple where with multiple sub queries based on int array
- method syntax for linq query with multiple from clauses
- how to write a Linq query with a EF code first Many to Many relationship
- Get the Matched Property Name in linq where with multiple condition
- How to handle null values in LINQ with multiple where clauses
- CRM 2011 LINQ query with multiple inner joins and a single WHERE clause (VB .NET)
- use linq to group by and then run select query with where condition
- Linq query to get count with multiple column values coming from condition on another column
- Search for overlapping date ranges
- Why is Entity Framework returning null?
- Get item count of a list<> using Linq
- How do I get a list of integers that exist in one collection, but not in another of a different type using LINQ?
- T-SQL to LINQ conversion
- How set value a property selector Expression<Func<T,TResult>>
- LINQ take average of multiple fields in query
- error Cannot implicitly convert type when Join Merged Data Table using Linq
- Can I use an embedded lambda with the Contains method?
- LINQ query with multiple StartsWith clause?
- Add Items To a existing List In a dictionary
- Using Row_Number in Linq where clause
- Strange .Where() behaviour. Somebody has an explanation?
- RIA Services linq problem - convert output
- Return particular result more than once
- Single statement query
- EF and LINK query not giving all table values in "select"
- SQL query to Lambda Expression C#
- Is it possible to pass an OrderBy expression as an argument?
- Looking for a better way to perform Left outer join on three tables in LINQ