Reading

// read in an entire atom feed
AtomFeed feed = AtomFeed.Load(new Uri("http://loluyede.blogspot.com/atom.xml");

-or-

// read in an atom entry
StringBuilder buffer = new StringBuilder(13);
buffer.Append(<entry xml:lang="en-us">);
buffer.Append(<title>The title of the entry.</title>);
buffer.Append(<link rel="alternate" type="text/plain" href="http://www.w3.org/" title="The title of the link." />);
buffer.Append(<contributor>);
buffer.Append(<name>Uncle Bob</name><url>http://people.w3.org/</url><email>foo@bar.com</email>);
buffer.Append(</contributor>);
buffer.Append(<id>http://localhost/foo/id</id>);
buffer.Append(<modified>2004-02-12T17:43:22+01:00</modified>);
buffer.Append(<issued>2004-02-12T17:43:22+01:00</issued>);
buffer.Append(<created>2004-02-12T17:43:22+01:00</created>);
buffer.Append(<summary>The summary of the entry.</summary>);
buffer.Append(<content>The content of the entry.</content>);
buffer.Append(</entry>);

AtomEntry entry = AtomEntry.LoadXml(buffer.ToString());
top
Writing

// create root feed element
AtomFeed feed = new AtomFeed();

// build the object model for the atom feed
feed.Title = new AtomContentConstruct("title", "The title of the feed.");
feed.Links.Add(new AtomLink(new Uri("http://www.w3.org"),
    Relationship.Alternate, MediaType.TextPlain, "The title of the link."));
feed.Author = new AtomPersonConstruct("author",
    "Uncle Tom", new Uri("http://people.w3.org"), "foo@bar.com");
feed.Contributors.Add(new AtomPersonConstruct("contributor",
    "Uncle Bob", new Uri("http://people.w3.org"), "foo@bar.com"));
feed.Tagline = new AtomContentConstruct("tagline", "The tagline of the feed");
feed.Id = new Uri("http://localhost/foo/id");
feed.Copyright = new AtomContentConstruct("copyright", "Copyright  2003 - 2005");
feed.Info = new AtomContentConstruct("info", "The info of the feed.");
feed.Modified = new AtomDateConstruct("modified", DateTime.Now,
    TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now));

// add a simple atom entry
AtomEntry entry = new AtomEntry();
entry.Title = new AtomContentConstruct("title", "The title of the entry.");
entry.Links.Add(new AtomLink(new Uri("http://www.w3.org"), Relationship.Alternate,
    MediaType.TextPlain, "The title of the link."));
entry.Contributors.Add(new AtAtomPersonConstruct("contributor",
    "Uncle Bob", new Uri("http://people.w3.org"), "foo@bar.com"));
entry.Id = new Uri("http://localhost/foo/id1");
entry.Modified = new AtomDateConstruct("modified", DateTime.Now,
    TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now));
entry.Issued = new AtomDateConstruct("issued", DateTime.Now,
    TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now));
entry.Summary = new AtomContentConstruct("summary", "The summary of the entry.");
entry.Contents.Add(new AtomContent("The content of the entry."));

// add the entry to the feed collection
feed.Entries.Add(entry);

// save the entire feed to a stream
Response.ContentType = Atom.Utils.DefaultValues.AtomMediaType.ToString();
feed.Save(Response.OutputStream);

- or -

// save only the entry
entry.Save("snippet.xml");
top
ASP.NET Example - VB.NET - (thanks to Russell Lindell)

'///////////////////////////////////////////////////////////
' Codebehind functions
'///////////////////////////////////////////////////////////
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not Page.IsPostBack Then
            Dim myFeed As AtomFeed = AtomFeed.Load("http://rwlindell.com/blog/atom.xml")

            getLatestEntry(myFeed)
            dgEntries.DataSource = getLatestPostings(myFeed, 0, 5)
            dgEntries.DataBind()
        End If
    End Sub
'///////////////////////////////////////////////////////////


'///////////////////////////////////////////////////////////
    'posts the full latest entry
    Sub getLatestEntry(ByRef myFeed As AtomFeed)
        hypTitle.Text = myFeed.Entries.Item(0).Title.Content
        hypTitle.NavigateUrl = myFeed.Entries.Item(0).Links.Item(1).HRef.ToString
        lblDate.Text = String.Format(("{0:d}", myFeed.Entries.Item(0).Issued.DateTime)
        lblContent.Text = myFeed.Entries.Item(0).Contents.Item(0).ToString
    End Sub
'///////////////////////////////////////////////////////////


'///////////////////////////////////////////////////////////
    'returns list of headlines
    Function getLatestPostings(ByRef myfeed As AtomFeed, Optional ByVal iStart As Integer = 0, Optional ByVal iEnd As Integer = 2)
        Dim myDS As New DataSet

        myDS.Tables.Add("tblEntries")
        myDS.Tables("tblEntries").Columns.Add("title")
        myDS.Tables("tblEntries").Columns.Add("url")
        myDS.Tables("tblEntries").Columns.Add("date")

        'populates the DS table
        Dim i
        Dim myRow As DataRow = myDS.Tables("tblEntries").NewRow()
        For i = iStart To iEnd
            Dim myValues(2) As String

            myValues(0) = myfeed.Entries.Item(i).Title.Content
            myValues(1) = myfeed.Entries.Item(i).Links.Item(1).HRef.ToString
            myValues(2) = String.Format("{0:M/d}", myfeed.Entries.Item(i).Issued.DateTime)
            myDS.Tables("tblEntries").Rows.Add(myValues)
        Next


        Return myDS.Tables("tblEntries")
    End Function

'///////////////////////////////////////////////////////////
' .aspx code
'///////////////////////////////////////////////////////////
<table width="100%" class="text1">
	<tr>
		<td align="left"><strong>Current Blog Post:</strong>
			<asp:hyperlink id="hypTitle" runat="server"></asp:hyperlink></td>
		<td align="right"><asp:label id="lblDate" runat="server"></asp:label></td>
	</tr>
	<tr>
		<td colSpan="2"><asp:label id="lblContent" runat="server"></asp:label></td>
	</tr>
</table>
top
Retrieve feed data behind a proxy - VB.NET - (thanks to Hilton Giesenow)

Dim oWebRequest As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(strUrL)
Dim oProxy As New System.Net.WebProxy(strProxy, 8080)
oProxy.Credentials = New System.Net.NetworkCredential(strUserName, strPassword, strDomain)
oWebRequest.Proxy = oProxy
Dim oResponseStream As New System.IO.StreamReader(oWebRequest.GetResponse.GetResponseStream, System.Text.Encoding.ASCII)

Dim myFeed As Atom.Core.AtomFeed = AtomFeed.Load(oResponseStream)
dg1.DataSource = myFeed.Entries
dg1.DataBind()
top