Module 1: From C# 2.0 to C# 3.0
This module explains how to apply C# 3.0 language features in real applications, and provides the motivation for each feature, categorizing them into four distinct groups: Developer productivity features, Extensibility features, Functional programming features and LINQ support features.
Lessons
• Developer Productivity Features – Implicit typing, Object and collection initializes, Automatic properties, Anonymous types.
• Extensibility Features – Extension methods, Partial methods.
• Functional Programming Features – Lambda expressions, Expression trees.
• LINQ Support Features – An overview of language query operators.
Lab : Extension Methods and IEnumerable
• ForEach extension method for IEnumerable.
• MaxElement extension method for IEnumerable.
Lab : Extension Methods and Anonymous Types
• Extension method for turning anonymous types into tuples.
After completing this module, students will be able to:
• Extend existing types using extension methods.
• Use lambda expressions and expression trees for simple functions.
• Initialize collections and objects and use automatic properties and anonymous types to facilitate productivity.
Additional Reading
To help you prepare for this class, review the following resources:
• Microsoft Developer Network: Introduction to Generics (C# Programming Guide) at:
http://msdn.microsoft.com/en-us/library/0x6a29h6.aspx
• Microsoft Developer Network: Iterators (C# Programming Guide) at:
http://msdn.microsoft.com/en-us/library/dscyy5s0.aspx
• Microsoft Developer Network: Anonymous Methods (C# Programming Guide) at:
http://msdn.microsoft.com/en-us/library/0yw3tz5k(VS.80).aspx
• Microsoft Developer Network Magazine: Create Elegant Code With Anonymous Methods, Iterators and Partial Classes at http://msdn.microsoft.com/en-gb/magazine/cc163682.aspx