Skip to content

Instantly share code, notes, and snippets.

@markdstafford
Created April 25, 2013 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markdstafford/5456958 to your computer and use it in GitHub Desktop.
Save markdstafford/5456958 to your computer and use it in GitHub Desktop.
Code for OData 101: Building our first OData consumer
using System;
using System.Linq;
namespace OData101.BuildingOurFirstODataConsumer
{
internal class Program
{
private static void Main()
{
var context = new Netflix.NetflixCatalog(new Uri("http://odata.netflix.com/Catalog"));
var titles = context.Titles
.Where(t => t.Name.StartsWith("St") && t.Synopsis.Contains("of the"))
.OrderByDescending(t => t.AverageRating)
.Take(10)
.Select(t => new { t.Name, t.Rating, t.AverageRating });
Console.WriteLine(titles.ToString());
foreach (var title in titles)
{
Console.WriteLine("{0} ({1}) was rated {2}", title.Name, title.Rating, title.AverageRating);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment