Suresh Behera

The Microsoft .Net Junkies




April 2011 - Posts

Easy way to write WHERE IN clause in Linq

I found many links to write IN clause in Linq but following is the simplest way achieve this

public IEnumerable<Products> GetProductsByIds(List<int > ids)
    from id in Products
    where (x => ids.Contains(x.Id))
    select new {x.Id, x.ProductName};

var productids = new List<int> { 33,34,35,36 };



Happy Coding..!

Suresh Behera

Posted: Apr 29 2011, 02:54 PM by Suresh Behera | with 1 comment(s) |
Filed under: ,
Converting SQL To Linq

After working so long on I SQL ,you always need little trick to write you Linq Quires.Here is few tools which might help to generate your linq quries.

SQL to LINQ converter

Code Generation in LINQ to SQL

LINQPad : Code generation for Linq

Converting SQL to LINQ

101 LINQ Samples


Suresh Behera

Posted: Apr 29 2011, 02:08 PM by Suresh Behera | with no comments |
Filed under: ,
101 LINQ Samples

Awesome list of LINQ sample

Restriction Operators
Projection Operators
Partitioning Operators
Ordering Operators
Grouping Operators
Set Operators
Conversion Operators
Element Operators
Generation Operators
Aggregate Operators
Miscellaneous Operators
Custom Sequence Operators
Query Execution
Utility Routines
Join Operators



Suresh Behera

Posted: Apr 13 2011, 11:37 AM by Suresh Behera | with 2 comment(s) |
Filed under: ,
More Posts