a first look at c#

June 29th, 2006

The first I heard of c#, Microsoft's flagship new language for seamless software development from 2000, one of the first reviews of c# came from some higher-up in the Java hierarchy of Sun. His conclusion paraphrased here for your convenience, was "c# is basically a botched ripoff off java". He was saying that what java had done right, c# had changed for the worse, otherwise it was pretty much the same.

As I got my first introduction to c# recently, I wouldn't entirely agree with that. I'd say c# is (as announced), indeed a hybrid java/c++ combo. At first sight, it looks like java, but certain things are basically ripped right out of c++:

  • pass by reference for primitive types
  • virtual methods
  • operator overloading
  • user defined copy constructors
  • namespace declarations

And some things are completely new and wacky:

  • properties defined implicitly with accessors (not unlike ruby)
  • overriding base class constructors in derived classes (what does this say of encapsulation? hm)
  • sealed (non-derivable) classes
  • structs (from c) as lightweight alternative to classes
  • foreach statement (similar to php)
  • delegates (a bit like function pointers in c++)

In a way it looks like c# went completely java, but they couldn't bare to leave behind certain features of c++. And that's reasonable, it becomes some sort of superset of the two and with a rich library. My impression so far is that it seems to be java without some of the pain.

:: random entries in this category ::