Mar/100
Silverlight 3, LINQ, and Bing! Oh, my!
In my last post I talked about Silver Shorts and showed off my example Bing Image search application.
For this post I want to go over the code that I created for doing a Bing image query, to demonstrate just how powerful and concise Silverlight 3 C# code can be. To truly appreciate this, I suggest checking out the code, which totals about 225 lines for both the Image Search utility AND the Test Application.
To get started, let’s enumerate the requirements I came up with for the project:
- Image Search
- Bing Image query based on textual search terms
- Transform XML results into custom classes
We’ll refer back to these requirements as we build the code to make sure we stay on track.
Mar/100
Project Silver Shorts
Last week I decided to install the Visual Studio 2010 RC for the purposes of messing around with C#, Silverlight 3, and all the new WPF goodness that came with it. I only intended to dabble for a day or so, but ended up having my entire week consumed in what seemed like a moment.
If you have Silverlight installed, you can view the end result of my first experiment after the page break. It is a simple Bing image searcher that displays thumbnails of the results on a canvas.
What is Project Silver Shorts?
More than anything Silver Shorts is an idea, a codename for a collection of demos in C#, most of which have yet to be written, targeting Silverlight 3, that are intended to be Short. As I stumble and bumble my way around .NET, finding new and interesting things to do with it, I will make my experiments available with full source code on GitHub (skip to the bottom if all you care about is code.)
For the developers in the audience, let’s take a look at a simple LINQ query I have fabricated to summarize the goals of Silver Shorts while simultaneously showing off how neat LINQ is.
var blogPosts =
from exp in user.Experiences()
where exp.IsAwesome
select new BlogPost()
{
Title = exp.Concept,
Content = exp.Details,
CodeUrl = exp.GitUrl;
};
To be painfully and obnoxiously clear, this code example is not part of the actual demo program, it is only here to look pretty and be a conversation piece.
