Part 1: Preparing for the journey
Chapter 1: The changing face of C# development
- Evolution in action: examples of code change
I won’t be able to include the C# 4 features by just evolving the existing code… at least, not the big ones. Options:
- Stick with the existing example for 1 to 2 and 2 to 3, but change to a different problem for 4
- Try to work out a different example to show all of 1 to 2, 2 to 3 and 3 to 4
- A brief history of C# (and related technologies)
Update this with what’s been happening since 2008 and possibly slim down what’s already there
- The .NET platform
Add the new versions, including .NET 3.5 SP1, and introduce the DLR in the terminology part.
- Fully functional code in snippet form
Nothing new to add about Snippy, but there may be another tool to talk about as well.
Chapter 2: Core foundations: building on C# 1
- Type system characteristics
- Value types and reference types
- Beyond C# 1: new features on a solid base
Introduce interface/delegate variance and the
Part 2: Solving the issues of C# 1
Chapter 3: Parameterized typing with generics
- Why generics are necessary
- Simple generics for everyday use
- Beyond the basics
Add a tip and example about using generic static methods in a non-generic type to take advantage of type inference when creating instances of generic types.
- Advanced generics
- Generic collection classes
It would probably make sense to include HashSet<T> here, and possibly any new collection classes in .NET 4.0. Version warnings would be given, of course!
- Limitations of generics in C# and other languages
Refer to part 4 in terms of variance, and possibly trim down the coverage of alternative approaches.
Add an example of Marc Gravell’s work for generic operators, or at least refer to it. Possibly mention the idea of static interfaces. Both give food for thought, but aren’t really part of C#.
Chapter 4: Saying nothing with nullable types
- What do you do when you just don’t have a value?
- System.Nullable<T> and System.Nullable
- C# 2’s syntactic sugar for nullable types
- Novel uses of nullable types
Possibly include Marc Gravell’s teaser about calling all the Object methods on a null value.
Make sure the summary is typeset as 4.5 instead of as part of 4.4. Oops!
Chapter 5: Fast-tracked delegates
- Saying goodbye to awkward delegate syntax
- Method group conversions
- Covariance and contravariance
Mention generic delegate variance in C# 4, referring to part 4.
- Inline delegate actions with anonymous methods
- Capturing variables in anonymous methods
Chapter 6: Implementing iterators the easy way
- C# 1: the pain of handwritten iterators
- C# 2: simple iterators with yield statements
- Iteration in the real world
Renamed section, but keep first example – possibly make it shorter.
Add iteration over lines in a file.
Add generation iterator, referring to LINQ.
- Pseudo-synchronous code with the Concurrency and Coordination Runtime
Fix sample code and explanation, with full article on the web
Chapter 7: Concluding C# 2: the final features
- Partial types
- Static classes
- Separate getter/setter property access
- Namespace aliases
- Pragma directives
- Fixed-size buffers in unsafe code
Part 3: New title TBD
Chapter 8: Cutting fluff with a smart compiler
- Automatically implemented properties
- Implicit typing of local variables
- Simplified initialization
- Implicitly typed arrays
- Anonymous types
Chapter 9: Lambda expressions and expression trees
- Lambda expressions as delegates
- Simple examples using List<T> and events
- Expression trees
Expand for new expression support in .NET 4.0 (clearly labeled as such)
- Changes to type inference and overload resolution
Check if/how this has changed in C# 4.0 spec
Chapter 10: Extension methods
- Life before extension methods
- Extension method syntax
- Extension methods in .NET 3.5
- Usage idea and guidelines
Update advice here and give some more examples.
Chapter 11: Query expressions and LINQ to Objects
Look at changing how the diagrams are formatted in this chapter.
- Introducing LINQ
- Simple beginnings: selecting elements
- Filtering and ordering a sequence
- Let clauses and transparent identifiers
- Groupings and continuations
- New section: extending LINQ to Objects
- Advice for writing your own extension methods
- Plug for MoreLINQ and other libraries
Chapter 12: LINQ beyond collections
- LINQ to SQL
Despite the rumours of its doom, I think this is the best place to start.
- Translations using IQueryable and IQueryProvider
- LINQ to DataSet
- LINQ to XML
- LINQ to Entities
Again, not much depth – still a whirlwind tour.
- Third-party LINQ (renamed from LINQ beyond .NET 3.5)
- Update state of play with third-party providers
- Example of PushLINQ – still using simple delegates, but against different interface
- Remove Parallel Extensions – moved to part 4
Chapter 13: Removed (new chapter at end of part 4)
Part 4: C# 4 (full title TBD)
Chapter 13: Dynamic binding in a static language
- Introduction to the DLR, IronPython, IronRuby
- Calling dynamically – the dynamic keyword
- Reacting dynamically – implementing IDynamicObject
- Applications for dynamic code
Chapter 14: More minor tweaks
- Named and optional arguments
- Variance of interfaces and generic delegates
- Simplifying COM interoperability
Chapter 15: Major new features of .NET 4.0
- Bullet-proofing your code with Code Contracts
- Simplifying concurrency with Parallel Extensions
- F# (?)
Chapter 16: Whither now?
- Educated guesses about C# 5
- The Renaissance developer
- Until we meet again
Appendix: LINQ standard query operators
Right now I’ve got a lot of flexibility – so please, I’d much rather hear ideas now than later.