In my code above I've taken advantage of a new language
feature in VB and C# called "anonymous types". Anonymous types
enable developers to concisely define inline CLR types within code, without
having to explictly define a formal class declaration of the type. You
can learn more about them in my previous New "Orcas" Language Feature: Anonymous Types
While anonymous types can be super useful when you want
to locally iterate and work with data, we'll often want/need to define
a standard class when passing the results of our LINQ query between
multiple classes, across class library assemblies, and over web-services.
To enable this, I could define a non-anonymous class
called "FeedDefinition" to represent our Feed data like so:
Note above how I'm using the new "Automatic Properties" feature of C# to define
the properties (and avoid having to define a field for them).
I could then write the below method to return back a
generics based List<FeedDefinition> collection containing FeedDefinition
Note above how the only change I've made to the LINQ to XML
query we were using before is to change the "select" clause from
"select new" (with no type-name) to "select new
FeedDefinition". With this change I'm now returning a sequence of
FeedDefinition objects that I can pass from class to class, assembly to
assembly, and across web-services.