What advantages does C# have?

This is a discussion on What advantages does C# have? within the C# Programming forums, part of the General Programming Boards category; I have learned some C and C++, but I have not yet studied C#. I'm not criticizing the language, but ...

What advantages does C# have?

I have learned some C and C++, but I have not yet studied C#. I'm not criticizing the language, but I'm just wondering and trying to find out-why use C# instead of C++? What advantages/disadvantages does it have when compared to C++. If Microsoft runs bankrupt or something ten years from now, will that have any impact on the usefulness of C#?

C# is a more high-level approach than C++. It is usually faster to develop in. It comes with a large framework of predeveloped components, which makes it particularly useful for server-side programming. It is full of features that make development faster and easier, usually at the cost of flexibility and/or runtime performance.

If MS goes bankrupt, C# is not dead: it is a standardized language, as are the core parts of the framework. However, large parts of the .Net framwork are still MS's own and in the unlikely case that MS drops C#, there would probably be a significant loss of investment.
On the other hand, and though I'm not really knowledgeable about the subject, I'd guess Java users would suffer more if Sun dropped out; in some ways at least.

I am not the most experienced nor considered an expert or even advanced user in C, C++ or C# but I can speak to what I have done between C++ and C# and the books I have read about the comparisons.

CornedBee said most of them already and had a great break down. I use C++ for fast responsive hardware based programing or socket type programing, network stuff where I need really fast response times.

I use C# for programing mobile devices such as windows mobile or windows CE for the Visaul Studio .Net components for easy coding and connectivity on such platforms. Also most the coding I have done or seen done with web services and alot of server to server services of the type C# has some really neat components for simplifying code. It also simplies database programing for MS SQL Server, also Oracle, but mostly SQL, by simplifying connections and query execution.

I have really had to adopt both principles, C# and C++ in the past 3 years at the place I work because of the multitude of different applications, machine, server and mobile devices, like Symbol Mobile Computers. I enjoy them both, but ask me my preference and I guess because of my old nature, I like C++. But you will want to adopt the .Net Extended C++, .Net VB and C# if you want to excel in the MS Windows Programing World, at least thats what I have seen in profession.

CornedBee said most of them already and had a great break down. I use C++ for fast responsive hardware based programing or socket type programing, network stuff where I need really fast response times.

strange that you say that for network programs where most time is spent waiting for network I/O and has nothing to do with language.
I also noticed a trend on this forum that a large part of all topics are about performance

Like you say , you spend most of the time waiting for the network I/O , then its essential to do whatever it is that is needed to be done with the data and get ready for the next bunch of data...

For instance, you are programming the IOS of a router, you already need to wait before the signal traverses the whole cable length, then the last you want is to introduce more latency because of the things the IOS is performing on the data ( for example acl's , check routing tables etc etc ).

For instance, you are programming the IOS of a router, you already need to wait before the signal traverses the whole cable length, then the last you want is to introduce more latency because of the things the IOS is performing on the data ( for example acl's , check routing tables etc etc ).

You really have to look at the whole picture.

at first I agreed with you, but then I noticed you're somebody else then who I quoted.
He was talking about sockets windows programming, not about routers or something where C# is not in the picture at all.

This is like saying:
"I choose C if I do socket programming on windows cos I want speed"

"speed that doesnt matter with sockets its np to use C#"

"but I have a commodore 64 on which I'm making a router so I have to use C"

"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg."-Bjarne Stroustrup
Nearing the end of finishing my 2D card game! I have to work on its 'manifesto' though <_<

well, it's more "visualish" so it's easy to work with, however, it doesnt really have "real" pointers and not as fast as C++ or C and it only works under .NET development

Heh, the old saying goes the first major hurdle in C++ is learning how to use pointers, and the second major hurdle is learning how not to use pointers.

I've used C# on two projects and I absolutely love the rapid development time; I've never had an application yet where speed differences become appreciable, but I can develop a fully working program in maybe a third of the time in C# (probably more like 1/10th the time compared to pure WinAPI which is nice to know but too slow to develop with for my tastes).

In my opinion there are two big advantages in using C# over C when you consider most windows based programs, except for 3D games:

- The trend established itself. Many companies require programming experience in C#. It won't hurt to have this knowledge if you plan to proceed with a career in windows programming.

- Microsoft Products already dropped their native C++ rapid application development tools. If you need to visually program in C++, you can't anymore with Microsoft Studio line of products. Windows based development in native C++ has dropped in speed considerably for the C++ programmers insisting on using the latest Microsoft development software for GUI based development. This seems to indicate Microsoft is trying to push programmers away from MFC and eventually drop it altogether (something probably a few good years away still). C# becomes then a programming language to take into consideration, since I don't see Microsoft stepping back from their strategy anymore, and support for native C++ GUI programming becoming more and more a thing of the past for Microsoft products.

Considerations of performance or specific language features are usually void, unless there is a critical need for them, which usually is not the case on a large amount of programs. There will always be room for C++ in windows programming though, unless a major revolution occur. And it is still the language of choice for too many problems, ranging from software that one wants portable to software that uses specific technologies or techniques that other languages find it hard to offer (3D being one of the major examples).

There is also a huge amount of knowledge worldwide around C++ that is freely shared, openly debated, and which future development is decided by the community. Three aspects a proprietary language can never compete against.

So I'd say if you want to program in windows, and you want to make this your career then you should learn C# while keeping a solid knowledge in C++. If you don't want to become a professional programmer then it's your choice if you do or not. If you don't want to program in windows, then you don't need C#.

The main advantage it has is the # in the name. Every one knows that C++ is better than C, because it has a ++ on the end of its name. Knowing this, it's obvious that C# is far superior to C++, because its symbol is the natural, well at least in Microsoft's eyes, extension of that.

How's that? Well what's better than one? That's right. Two. Two is better than one. Two ++ must be better than one ++, right? Clearly they couldn't call it C++++, because that would be too many things to type. But wait, what if we stack them?