I’ve been using C# personally quite a bit lately and want to share with you a list of the things I like or don’t about it.

First the things I like about it (compared to C++ and Java sometimes):

  • The out and ref keywords are awesome You actually need to use them both when declaring out and reference parameters and in the actual function calls. This really avoids confusion and makes the code clearer compared to the way references are transparently handled in C++.

  • a class’s definition and declaration is kept in just one file Avid C++ coders will probably disagree with me here, but I really like this way of coding things. It allows me to code faster and also reduces one source of compiler errors. To be honest I would probably go insane when coding in C++ if it wasn’t for Visual Assist’s nifty “Move Implementation to Source File” and “Create Declaration/Implementation” refactorings. Likewise one could say that C#’s (or .NET’s) notion of assemblies is better and less messy than C/C++’s compilation units.

  • Properties are simply awesome Properties look like normal member variables but you can write your own getter and setter functions and also give both different access levels, so e.g. you can have a property that is public for reading but protected for writing. Moreover, you can have C# create the code automatically, so you just end up with a way to specify separate access levels.

  • Read-only variables can be set anywhere in the constructor If you know C++’s initialization lists, you will thank god for this feature, because this feature gives you a lot more freedom and again results in more readable code (at least in my opinion).

  • The override and new keywords are really handy Again this is a feature to avoid unnecessary bugs because you get warnings as soon as you “override” a method that doesn’t exist.

What I don’t like:

  • No typedefs This really bugs me, because the concept of typedefs is a good way to add abstraction to your code and the using keyword in C# only marginally improves the situation, because it only affects the current module.

  • No default/optional parameters You have to overload methods instead, which is kind of annoying. I hope this gets fixed sooner or later.

  • No inner classes like in Java Passing on references to constructors is annoying and inner classes in Java really help it quite often.

  • No synchronized keyword like in Java Again this is a nice-to-have feature because it would  clean up some code.