Browse by Tags

All Tags » C# 4 (RSS)

Contract classes and nested types within interfaces

I've just been going through some feedback for the draft copy of the second edition of C# in Depth. In the contracts section, I have an example like this: [ContractClass( typeof (ICaseConverterContracts))] public   interface ICaseConverter {...
Posted by skeet | 9 comment(s)
Filed under: , , ,

Recent activities

It's been a little while since I've blogged, and quite a lot has been going on. In fact, there are a few things I'd have blogged about already if it weren't for "things" getting in the way. Rather than writing a whole series...

Tricky decisions... Code Contracts and Parallel Extensions in C# in Depth 2nd edition

I'd like some feedback from readers, and I suspect my blog is the simplest way to get it. I'm currently writing chapter 15 of C# in Depth, tentatively about Code Contracts and Parallel Extensions. The problem is that I'm 15 pages in, and I...
Posted by skeet | 83 comment(s)
Filed under: , ,

Evil Code of the Day: variance and overloading

(Note that this kind of breakage was mentioned a long time ago in Eric Lippert's blog , although not in this exact form.) Whenever a conversion becomes available where it wasn't before, overload resolution can change its behaviour. From C# 1 to...
Posted by skeet | 6 comment(s)
Filed under: , ,

Faking COM to fool the C# compiler

C# 4 has some great features to make programming against COM components bearable fun and exciting. In particular: PIA linking allows you to embed just the relevant bits of the Primary Interop Assembly into your own assembly, so the PIA isn't actually...
Posted by skeet | 1 comment(s)

Evil code of the day

At a glance, this code doesn't look particularly evil. What does it do though? Compile it with the C# 4.0b1 compiler and run it... using System; class Base {     public   virtual   void Foo( int x, int y)    ...
Posted by skeet | 35 comment(s)
Filed under: ,

OS Jam at Google London: C# 4 and the DLR

Last night I presented for the first time at the Google Open Source Jam at our offices in London. The room was packed, but only a very few attendees were C# developers. I know that C# isn't the most popular language on the Open Source scene, but I...
Posted by skeet | 19 comment(s)

Dynamic type inference and surprising possibilities

There have been mutterings about the fact that I haven't been blogging much recently. I've been getting down to serious work on the second edition of C# in Depth, and it's taking a lot of my time. However, I thought I'd share a ghastly...
Posted by skeet | 9 comment(s)
Filed under: , ,

C# 4.0: dynamic<T> ?

I've not played with the VS2010 CTP much yet, and I've only looked briefly at the documentation and blogs about the new C# 4.0 dynamic type, but a thought occurred to me: why not have the option of making it generic as a way of saying "I...

DotNetRocks interview

Last Monday evening I had a chat with the guys from DotNetRocks , and today the show has gone live . I wouldn't claim to have said anything particularly earth-shattering, and regular readers will probably be familiar with many of the themes anyway...

C# 4: Immutable type initialization

(I'm giving up with the numbering now, unless anyone particularly wants me to keep it up. What was originally going to be a limited series appears to be growing without end...) As Chris Nahr pointed out in my previous post , my earlier idea about...
Posted by skeet | 23 comment(s)
Filed under: ,

C# 4 idea: Iterator blocks and parameter checking

Iterator blocks have an interesting property: they defer execution. When the method (or property) is called, none of your code is executed - it only starts running when MoveNext() is first called. Deferred execution is a great thing in many ways, but...
Posted by skeet | 11 comment(s)
Filed under: ,

Language design, when is a language "done", and why does it matter?

As per previous posts, I've been thinking a fair amount about how much it's reasonable to keep progressing a language. Not only have thoughts about C# 4 provoked this, but also a few other sources: Don Box on Ted Neward on Java (yes, two separate...
Posted by skeet | 8 comment(s)
Filed under: , ,

C# 4, part 4: My manifesto and wishlist

The final part of this little series is the one where I suggest my own ideas for C# 4, beyond those I've already indicated my approval for in earlier posts. Before I talk about individual features, however, I'd like to put forward a manifesto...
Posted by skeet | 46 comment(s)
Filed under: ,

Macros, and languages within languages

Ian Griffiths mailed me about macros, and explained how LISP macros were very different to C/C++ macros, working at a language level instead of at a text level. I won't pretend to understand all about what would be possible and what wouldn't,...
Posted by skeet | 12 comment(s)
Filed under: , , ,

C# 4, part 3: Ideas from Microsoft

Microsoft haven't committed to anything in C# 4 yet. However, there have been hints about what they've been considering in Eric Lippert's blog , and more than hints in Charlie Calvert's blog . There's not a lot to go on yet, but: Immutability...
Posted by skeet | 14 comment(s)
Filed under: ,

C# 4, part 2: Ideas from other community members

There has been a fair amount of speculation online about what should be in C# 4. I've taken the list below from a few posts, primarily those by Ayende and Jeremy Miller . I've deliberately left out the ideas that Microsoft have mentioned that...
Posted by skeet | 23 comment(s)
Filed under: ,

C# 4, part 1: Looking back at the past

Everyone else is speculating about what's going to be in C# 4 (and various possibilities are coming out of MS), so I thought it would be wise to start my own series of wishlist posts before I miss the boat completely. In this first post, I'm not...
Posted by skeet | 21 comment(s)
Filed under: ,