vb.net - C# equivalent of VB LINQ Query -


i have following query in vb, not know how translate c# synatax

 dim q = c in db.customers         group join o in db.orders on c.customerid equals o.customerid orders = group          select new {c.contactname, .ordercount = orders.count()} 

thank you

it's pretty easy. have drop "group":

var q = c in db.customers         join o in db.orders on c.customerid equals o.customerid orders         select new { c.contactname, ordercount = orders.count() }; 

or, if you're looking lambda syntax:

var q = db.customers.groupjoin(db.orders,                                o => o.customerid,                                c => c.customerid,                                (c, orders) =>                                    new                                    {                                        c.contactname,                                         ordercount = orders.count()                                    }); 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -