views:

117

answers:

3

Linq is a very useful feature of C# 3.0 which has been out for a while now. Unfortunately, a number of the developers at the company I work for do not know much about Linq and how it can benefit them. As such, I've been given the opportunity to present an information session about Linq.

What I'm trying to figure out is, what is the best way to introduce other programmers to Linq?

At the moment I'm thinking about talking about

  • Linq to objects
  • Query Extension methods
  • Query Comprehension Syntax
  • Lambda Expressions
  • Deferred Execution

I believe that those encapsulate the basics of Linq but how do I present them so that programmers, who may never have have dealt with Linq previously, will be able to grasp the concepts and use them.

To what detail should I go in explaining how Lambda Expressions and deferred execution etc works? Should I focus on the theory or more on the practical examples of how Linq is used?

To reiterate, what is the best way to introduce Linq to other programmers?

+1  A: 

I'd start with an example of something that you do fairly often, with how you would do it in 2.0, and then how you would do it in Linq. That shows some syntax, and how it will make their lives easier. I'd recommend something like the Select or Where methods on List<T>.

Matt Grande
+4  A: 

Buy a couple of copies of Pro LINQ and get every developer to download LINQPad and its $19 Intellisense upgrade. The book is great (much better than the Manning LINQ in Action book) and LINQPad not only makes learning LINQ easy, but its snippets are easy to distribute and share the learning.

Start with arrays--there is lots of LINQ ROI lurking in lowly ol' arrays.

rp
+1 LINQPad was my first thought too.
JP Alioto
+1 for the Array stuff. I can't stand Linq-To-SQL, but the array stuff is what made the upgrade to 3.0 worthwhile.
Matt Grande
+3  A: 

Personally I would re-iterate (heh) the concepts of sets and operations on sets - especially the IEnumerable interface, and how commonly represented sets are a fundamental concept of LINQ.

I would also compare the syntax of traditional for and foreach loops with LINQ and do some compare and contrast...how are they different? What is LINQ exactly?

I'd talk about anonymous delegates for a bit and how they are related.

And finally, for God's sake, I'd illustrate the difference and importance between executing SQL on the database side versus LINQ on sets on the application side.

jscharf