I’ve been asked by my pointy haired boss to educate our new co-ops (interns) in the ways of C#. I have roughly ~30mins to cover the topics of Delegates, Events and Lambda Expressions. The time restriction is rather tight and the topics are broad. Since I’m not a C# guru, I would like some hints and pointers.
- Since my time is short, what points should I cover with respect to the three topics listed above?
- What are some good Do’s and Dont’s when using those three things?
- I might have time for a short Lambda Expr demo. What is the most common use of LExpr (probably a Select().Where() statement on an enumerable??) that I could demo?
Thanks.
EDIT: The students have working knowledge of C++ and Java.
If your boss is serious about this, at least ask to do one 30 minute session per topic. That will give you time to present it (very briefly), give them a quick demo and perhaps answer a few questions. After that, they should be given some time to play (or give them homework ;)).
How long do you have to prepare for this? As mentioned by Anthony Pegram‘s comment, you would do well to introduce these topics through Jon Skeet‘s book C# In Depth, 2nd Edition. You could always get the ebook if you don’t have time to get the hard copy (I’d recommend getting the hard copy because it is a great reference book and a coupon for a free version of the ebook is included).
In the book he covers the evolution of C#. For example, he covers the evolution from explicit delegates to inline delegate actions with anonymous methods to lambda expressions as delegates (part of the evolution to make LINQ a reality).
I would recommend reading the following:
chapter 2
Chapter 5
Chapter 9
Of course, if you are not able to get a copy of this book or don’t have enough time to prepare (good luck!), then here is a great article that is on par with Jon’s book. It is quite lengthy, but covers everything you need. It’s very clearly written and has good code samples. You may be able to preview this, then present it to your interns.