c# - linq sql - aggregate count -


i have linq returns correct data.

var numemails = (from row in emailbatchproposal   row.emailbatchid == emailbatchid select row.emailbatchproposalid).count(); 

however, if understand linq correctly, not perform optimally. grabs data , walks through list , counts rows. i'd linq (in background) use like:

select count(*) ... 

i trust performance reasons obvious.

does know proper way this?

actually, if linq query used collection implements iqueryable , supports translation underlying sql variant, quite basic functionality translate count function example correctly.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -