Geeks With Blogs
Blair's Burnt Offerings My weblog about .NET and other worldly things

To be honest, I haven’t been working on my entry to the Dare to Dream Different Challenge lately.  I was distracted by a comment on my blog by Jens Kühner correcting my post where I stated that Linq was not possible without generics.  Well, that got me searching, and I could only find proof implementations of Linq without generics, but not a full implementation of Enumerable.cs targeted to the Micro Framework.

So I started writing one.  Although, it is not complete yet, I thought it was far enough along that I should share it, and Grommet was born.  

The idea behind the Grommet Library was to implement functionality missing from the Micro Framework in the spirit of what the Micro Framework group has already done, that is to follow the full BCL API, but only include the the most used functionality.  I really hope that some day Grommet won’t be needed.

Right now, Grommet includes Linq (and with that attributes to allow for extension methods) and an HTTP/1.1 client (HttpWebRequest/HttpWebResponse).  It also has some other extensions, which you can see at the CodePlex site:

http://grommet.codeplex.com

To give you a flavor of the current Linq support, here is a code snippet:

public class RssFeed
{
    public string Name { get; set; }
    public string Url { get; set; }
    public DateTime LastUpdate { get; set; }
}

public void FeedTest()
{
    ArrayList feedList = new ArrayList()
    {
        new RssFeed() { 
            Name = "XBox Live's Major Nelson", 
            Url="http://feeds.feedburner.com/MajorNelson",
            LastUpdate = new DateTime(2009, 03, 27) },
        new RssFeed() { 
            Name = "Quirks & Quarks", 
            Url="http://www.cbc.ca/technology/quirks-blog/index.xml",
            LastUpdate = new DateTime(2009, 03, 28) },
        new RssFeed() { 
            Name = "Dilbert Daily Strip", 
            Url="http://feeds.feedburner.com/DilbertDailyStrip",
            LastUpdate = new DateTime(2009, 03, 27) },
        new RssFeed() { 
            Name = "MSDN Just Published", 
            Url="http://msdn.microsoft.com/rss.xml",
            LastUpdate = new DateTime(2009, 03, 19) },
    };

    var sortedList = feedList.OrderBy(x => ((RssFeed)x).LastUpdate.DayOfYear, new IntComparer())
                             .ThenBy(x=>((RssFeed)x).Name, new StringComparer());

    var feedsToUpdate = from feed in sortedList
                        where ((RssFeed)feed).LastUpdate > new DateTime(2009, 03, 20)
                        select (((RssFeed)feed).Name);

    foreach (var name in feedsToUpdate)
    {
        Debug.Print(name.ToString());
    }
}

I would really like Grommet to have more functionality in it, but I need to get back to working on my Challenge entry.  If you would like to contribute to Grommet, I appreciate any help the community can provide. 

Blair.

Posted on Thursday, March 26, 2009 9:30 AM .NET Development , .NET Micro Framwork | Back to top


Comments on this post: Grommet: Linq, HTTP/1.1 and more for .NET Micro Framework

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Blair Leduc | Powered by: GeeksWithBlogs.net