HomeSupportCreate a Simple Feed Reader Console Application via C# + .NET [Tutorial]

A copy of the visual studio project for this application can be found here. The project includes a DLL reference to the Sample API as well which is discussed further here.

The application is comprised of 1 main file “Program.cs” which uses the sample API to print your feeds to a windows console, the source is displayed below, You will need to replace the API_KEY and baseUrl values with your own unique API_KEY and baseUrl provided to you:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SampleClientLibrary;

namespace Sample_DotNet_FeedReader
{
class Program
{
private static void getNewsArticles()
{
string API_Key = "your_api_key_here";
string baseUrl = "http://api.brafton.com/";

ApiContext ac = new ApiContext(API_Key, baseUrl);
//Iterate through each news item returned from your feed a print it's id, headline and publishdate on each line
foreach (newsItem ni in ac.News)
{
string id = "<id:" + ni.id + ">";
string headline = ni.headline;
string publishDate = "[" + ni.publishDate.ToShortDateString() + "]";

Console.WriteLine(id + " " + headline + " " + publishDate);
}
}

static void Main(string[] args)
{
getNewsArticles();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
}