C# Query Syntax
Posted: Wednesday, September 14, 2005 12:26 AM
by
dave
Filed under: PDC
Barry Gervin has a post with some LINQ links that is very useful.
Just to show you how easy it is. Here is the Query Don Box wrote during the key note today. I haven't seen it yet but I am told it's even easier to read in the VB syntax.
This is only the query itself so assume that p is a collection of processes and d is a class associated with a table and columns in the Database.
var query =
from p in Process.GetProcesses()
where p.WorkingSet > 4194304
orderby p.WorkingSet descending
Select new
{
p.ProcessName,
p.WorkingSet,
Description = ( from d in db.ProcessDescriptions
where d.processName == p.Processname
Select d.Description
).FirstOrDefault()
};
If you would like to receive an email when updates are made to this post, please register here