TekPub’s Mastering LINQ Challenge

I’ve been hard at work recently on my first video series for TekPub titled, Mastering LINQ. In this screencast series I am going to take the viewer on a journey through the basic building blocks of LINQ, all of the different LINQ methods available (including those in .NET 4.0), Parallel LINQ, Expression Trees, and then intros to LINQ to SQL and LINQ to XML.


Personally I think the video series is going to be great. :-) In order to introduce the different LINQ functions, I am going to load up StackOverflow’s open source dataset and slice and dice it. This will not only provide us with a good amount of data to see the different LINQ operations in action, but it will also make it a bit more interesting than just filtering lists of numbers.

If you haven’t checked out TekPub yet, I recommend that you head on over and check it out, there is a demo of the video up on the site that you can check out.

And finally, I have a little LINQ challenge for you with some prizes.

Here are the rules:

  1. You have to blog about a single LINQ query which starts with Enumerable.Range(1,n) and produces a list of prime numbers from the range.
  2. You can’t cheat. This is determined by me, and includes hardcoding values in the results. You’ll know if you cheated.
  3. Uses no custom LINQ methods.
  4. Will return all of the prime numbers of the sequence. It doesn’t have to be super optimal, but it has to be correct.
  5. Be one of the first 5 people to blog a correct answer and then tweet this "I just solved the @tekpub LINQ challenge: <link to post>" will get any single TekPub screencast. The time of your solution will be based on your tweet! So be prompt!
  6. You must link to both TekPub’s website and this post in your blog post.

Here is how I want it to start, and the whole thing has to be a single chained LINQ query following the Enumerable.Range:

var primes = Enumerable.Range(1, SomePositiveValue).SomeLinqMethod(

I can’t wait to see your results!

Be Sociable, Share!


  1. Way too late for the TekPub subscription, but thought I’d share my solution anyway – it’s a crude implementation of the Sieve of Eratosthenes in LINQ: http://blogs.imeta.co.uk/sstrong/archive/2010/01/09/828.aspx

  2. I have an annual subscription with TekPub and i am really satisfied.
    There are video with great quality and they are easy to understand evend if english is not my language.

  3. i read Mastering Linq

    it is a great approach to linq but i don’t have the XML file you have use in the examples

    please mail me

    thank you………..

Leave a Reply

Your email address will not be published. Required fields are marked *