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 Query
- Linq query and multiple where clauses with OR only first condition gets evaluated
- 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
- 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
- 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
- SQL to C# LINQ query with multiple group by inner queries and having clauses
- Multiple WHERE Clauses with LINQ extension methods
- LINQ Where with AND OR condition
- Selecting multiple columns with linq query and lambda expression
- Joining multiple where clauses in LINQ as OR instead of AND
- LINQ: differences between single Where with multiple conditions and consecutive Wheres with single condition
- linq to sql query with multiple where parameters
- LINQ query with a WHERE clause with multiple conditions
- Linq where clause with multiple conditions and null check
- LinQ query with multiple tables and extracting data
- Linq with optional Where clauses and Sql Server CE
- Linq with where clause in many-to-many EF Code First object
- LINQ - 'Could not translate expression' with previously used and proven query condition
- LinQ with Count and Where condition
- How to query many-to-many relationship with 'AND' condition using LINQ and Entity Framework
- How to query by where clause with EF code first
- C# - Linq optimize code with List and Where clause
- LINQ Query with Array input and variable Where Statements - Advice
- Linq filtering results with multiple Where clauses
- add where clauses to linq query with generic column name
- Fluent LINQ query with multiple join conditions, one of which being a simple equals and another a less than comparison between ids
- Linq sub query when using a repository pattern with EF code first
More Query from same tag
- How do I select every 6th element from a list (using Linq)
- call stored procedure with linq
- Updating list with linq instead of for each
- How can I do a check if current object date is 2 days older then current day?
- Linq with a dictionary
- Grid is not showing some values for columns from two tables
- Using LINQ in VB.NET with namespaces
- Order by multiple properties
- shift content of a dictionary by specified size to a new dictionary in C# LInq
- Adding a WHERE clause to a Group Join
- Using DeleteAllOnSubmit when the table has no primary key
- Converting SQL to LINQ with Multiple Tables and Group
- Long process method with LINQ Query should be in Queue
- Checking digits with decimal separator defined
- Store and Group <Key> based on <Value> of All Dictionary Records Where <Value> Matches X
- Using custom methods that return IQueryable in the LINQ to entities
- Getting all elements with a specific attribute in LINQ to XML
- Allowing a user to select column headers to import
- Checking syntax of strings - C#
- How to Sortby Multiple Colums - Linq to SQL
- syntax error in simple LINQ statement
- Two methods that differ only in LINQ where part - delegate?
- Linq to XML select node from config.xml (Lambda expression or classic query)
- Hierarchial Linq to SQL Query
- Map query result to typed list
- Invalid initializer member declarator when projecting into complex types
- How to group only subsequent items with the same property using linq
- MongoDB C# - how to do the following
- Why doesn't Distinct (Linq) work in a List of int[]?
- Parse a string to predicate