c# - Using multiple .Where() calls or && conditions for LinqToEntities queries -


are following 2 queries equivalent? if not equivalent, performs better? there way can see sql output of queries?

var query1 = items.where(i => i.enabled == true).where(i => i.name == "bob");  var query2 = items.where(i => i.enabled == true && i.name == "bob"); 

as andrew says, 2 options equivalent. 1 practically useful difference can generate conditions in where clause programmatically. example if wanted exclude names:

var query = items; for(string name in excluded)    query = query.where(i => i.name != excluded);  

this cannot done when writing query using && operator.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -