SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 27 | Next

Scott Klein

"Professional LINQ"

GetDirectories()
orderby di.Name
select new { dir.Name} ;
foreach {var item in dirQuery)
listBox1.Items.Add(item.Name);
This code uses some of the standard query operators to create a LINQ query. In essence, Microsoft has
taken the concept of query set operations and made them first-class operations within the
.NET Framework.
Here??™s another example. This one queries all the system processes on your PC using the Process class,
but notice that it uses the same query syntax as the previous example:
var procQuery =
from proc in Process.GetProcesses()
orderby p.WorkingSet64 descending
select new { p.Id, p.ProcessName, p.WorkingSet64} ;
foreach (var item in procQuery)
ListBox1.Items.Add(item.Id + " " +
item.ProcessName + " " +
item.WorkingSet64);
When you run this code, all the processes on your system will be listed in descending order by
memory usage.
Simply put, LINQ enables you to query anything that implements the IEnumerable interface. If you
can loop through the contents using the foreach statement, then you can query it using LINQ.


Pages:
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6