All 1 entries tagged Csharp3

No other Warwick Blogs use the tag Csharp3 on entries | View entries tagged Csharp3 at Technorati | There are no images tagged Csharp3 on this blog

March 16, 2006

LINQ demo

Follow-up to More Managed RSS from codeMonkey.Weblog();

OK - I had to get this quick demo up too:
FeedFolder folder = FeedFolder.GetRoot();
DateTime yesterday = DateTime.Now.Subtract(TimeSpan.FromDays(1));
var allItems = folder.AllFeeds.SelectMany(f => f.Items);

var items =
from item in allItems
where item.PubDate > yesterday
orderby item.Title
select item;

foreach (var item in items)
That above is using C#3.0 with LINQ to search for all items from all feeds that were published after yesterday. The results are also sorted by title.
Note how none of that required adding sort or filter code to the object model! LINQ is totally awesome!

Google Ads

Search this blog

Most recent comments

  • I scratched my eye while i was holding some kind of plastic packaging.. Anyways the corner of the pl… by Ercan on this entry
  • About a year ago my contacts that i was wearing, i guess were fautly, because shortly after they wer… by Jon on this entry
  • I got shower gel in my eye 4 and a half days ago, and becasue i rubbed my eyes a lot, i have scratch… by Chris on this entry
  • This website may help–health/tc/Eye–Injuries–Home–Treatment by S on this entry
  • I somehow got dirt, or debris in my eye. The terrible pain sent me in a tailspin. I was afraid of sa… by Bobbi on this entry


December 2020

Mo Tu We Th Fr Sa Su
Nov |  Today  |
   1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31         


Blog archive

RSS2.0 Atom
Not signed in
Sign in

Powered by BlogBuilder