Hi, what are the advantages of C# over C++? I have a little bit of knowledge in both of them, but I am going to choose which one to dedicate most of my time to.

Garbage collection is the most important, and outweighs the combination of all other advantages.

C# has anonymous functions, i.e. closures, which outweighs the combination of all the advantages below.

C# has an actual module system.

C# has generics, which are more powerful in some ways than C++'s compile-time template system, and less powerful in others -- I would describe them as a little bit less verbose.

C# has extension methods which are cute but only a minor advantage.

You get a little bit more certainty about the various primitive data types -- you know that an int is an Int32.

Did I mention garbage collection?

Unless you're doing low-level numerical computation where processor time is the limiting factor, or unless you're using a lot of C++ libraries, C# is preferable.

Another advantage of C# is that you can use better languages that run on .NET too, like F#, and other languages, like Boo.

c# is great but, it truly depends what you're going to code as to what you would probably best learning whats right for us isnt necessarily right for you

I used both. It's two different languages for two different purposes. For normal app company system, I just use C#. For something require extra power ex graphic editor or game, sometime I use C++.

For business applications (Database as backend) C# is better
For learning and teaching students what the programming is; C++ is better.

Besides what has been said. C# is more strict that C++.
e.g.: in C# you MUST have a boolean or expression that evaluates to a boolean after an if or while statement, in C++ you can also use integers like 0 or 1 for that.

This article has been dead for over six months. Start a new discussion instead.