Microsoft Visual Studio 2010

The cat's out of the bag! Hours ago at PDC '08, I got to watch Anders unveiled the new C# 4.0 language features that we've been working on. This unveiling was accompanied by some fantastic demos of our work in action. Even though I've been working on this stuff for the past year, I was still completely blown away by his demos.

I've gotten the chance to work on quite a few of those features, so over the next while, I'll be sharing with you all some of the things that we're doing, and will be anxiously awaiting your feedback.

So first off, for those of you who haven't heard, here are the language features that we're working on, and a brief description of them.

  1. Dynamic binding. We've introduced a new type, dynamic, which behaves much like object, but allows the operations performed on your object to be bound at runtime instead of compile time.
  2. Named and Optional parameters. You can now specify default values for your parameters, allowing them to be optionally specified at the call site. We've also added the ability for your arguments to be passed by name, so that you can specify exactly which arguments you want to give, and refrain from specifying the rest (assuming they're optional).
  3. Com interop features. We've done quite a bit of work to improve COM interop. These include:
    • No ref for COM calls. For all COM calls that take ref arguments, you can specify an argument without a ref, and the compiler will generate a local for you and generate a ref to that local as the argument.
    • No PIA. We have introduced the ability to deploy your applications which use Primary Interop Assemblies (PIAs) without referencing the actual PIA at runtime. This allows compiling against them, but not needing to ship them with your application.
    • Implicit dynamic for COM types. We now give you the option of turning all objects returned from COM into dynamics so that you can perform late bound calls off of them instead of having to cast the result in order to make it useful.
  4. Variance. We've introduced covariance and contravariance into the language for interface types and delegate types. For those looking for an excellent in-depth description of variance, visit Eric Lippert's blog.

All of these features are available in our CTP release, which is available here.

Stay tuned for more on these topics, including samples and detailed descriptions of what happens behind the scenes. I'll also discuss some of the design considerations that we took, and would love to get your feedback on those as well.