Course info
Aug 1, 2011
1h 34m

This course describes the new features in version 4.0 of the C# language, from optional and named parameters, support of new variance scenarios to the "dynamic" keyword for DLR interaction and a few new compiler options.

About the author
About the author

Oliver Sturm is a consultant and trainer on topics around .NET software architecture. An Associate Consultant at thinktecture, he is also well known as an author of training classes and articles, an expert on programming languages and a Microsoft C# MVP, and for his experience in the specialized area of DevExpress UI components and frameworks.

More from the author
Introduction to F#
4h 17m
Mar 7, 2012
DevExpress CodeRush and Refactor!
5h 3m
Oct 27, 2011
Section Introduction Transcripts
Section Introduction Transcripts

C# 4.0 - Parameters
Hi, this is Oliver Sturm, and in this module, I'm going to talk to you about the new parameter-related features in C# version 4. 0. This is the first module in a series of modules that will show you all the new features in this new version of the C# language. I'm going to start by talking about optional parameters. Typically, whenever you call a method in C#, you have to pass all the parameters the method declares. Optional parameter are an exception to that rule. Named parameters is my next topic, a feature that allows you to pass parameters by their names. Of course, these two new features can be combined. Overload resolution is the mechanism that figures out which version of a particular method needs to be called, of course, if there is more than one version available. This mechanism had to be extended somewhat to accommodate the new parameter features. And finally, I want to have a look at some unexpected or perhaps unexpected behavior that you might encounter when you use those new features.

C# 4.0 - Co- and Contravariance
Hey, this is Oliver Sturm. In this module, I'm going to walk you through the topic of variance specifically some extensions provided by C# 4. 0 and that area. My outline is quite short. I'm going to start by explaining what variance is in general terms and I'll show you examples of variance scenarios that were supported in previous versions of C# then I'm going to move on the new features in C# 4. 0 which offered two new keywords to support variance for generic parameters and interfaces and delegates.

C# 4.0 - "dynamic"
Hi, I'm Oliver Sturn. In this module, I will show you the new dynamic keyword in C# 4. 0 and demonstrate its use cases. I will start by showing you how the new keyword can be used. And in which situations it cannot be used. Then I'll explain how the keyword is interpreted by the compiler. In other words, what the keyword actually does. I have a common misconception to clear up when it comes to the use of dynamic in place of. NET Reflection. And finally, I'm going to show two demos of using dynamic to interface with Excel through Office Automation and with IronPython, an actual dynamic programming language.

C# 4.0 - New Compiler Options
Hi, I'm Oliver Sturm. In this module I will talk about some new features in C # 4. 0 that I want to summarize as compiler options. There are two features I want to mention. First, there is a feature now that allows you to embed type information from COM assemblies in your own assembly, thereby simplifying versioning and coupling more loosely. Second, the compiler option /app config can be used to specify an app. config file directly to the compiler to influence an assembly's behavior during the binding phase.