Why do we need C#?

It was asked why do we need C# language?  Could you please describe experts?

What are the disadvantages of languages prior to C#? How C# does overcome them?
LVL 16
Easwaran ParamasivamAsked:
Who is Participating?
Jaime OlivaresSoftware ArchitectCommented:
C# is by far more featured than pure C++. Some key features:
- Garbage collection
- Array bounds checking
- Autoboxing
- Static constructors
- Reflection
- No need for header files and #includes
- Attributes
- Properties
- Delta expressions
- Anonymous delegates
- Exceptions have access to a stack trace
- Finally block for exceptions
- Unsafe mode
 etc, etc, etc.

The reason: C# has been created decades after C++ and borrowed the concepts from other languages like Java and Delphi (and C++ of course)

C++/CLI is an intermediate option between C++ and C# but its code doesn't look as cleaner as C#.
Here is a great blog about C# and C++/CLI: http://blogs.msdn.com/b/texblog/archive/2005/06/02/424588.aspx
It completely depends on what your project is, what your needs are and what your knowledge is. There are way too many languages to make a straight-forward comparison, but you can try to look into these links:

That being said, unless you have some very specific needs, you don't really NEED C#. Normal apps, like a DB front-end, etc, can be done in multiple languages. Again, it's mostly about your needs and knowledge (and budget, in some cases).

as above said...it depends on the project or the needs of the software....but C is the basis of alot of programs including windows at a point
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Microsoft has deprecated all other language but c++, javascript,  and NET language (c#,VB.NET, ...). So it assumed that community working with Microsoft technologies had made the change.
New developments with Microsoft technologies should use language that support from Microsoft is still available.
One point that should be made is that C# is kinda like VC++ adapted to the .Net framework. All the new .Net languages have inbuilt support to this framework. Also, in a sense, it IS an upgrade (not in all cases, but mostly) to the previous language.
@Cluskitt, C++ CLI avaliable.
It was my understanding that C# is a (sort of) upgrade from VC++, which isn't the same as C++. I may be wrong, though.
C# it was designed to be very similar to c++, but they needed to add some syntax to make use of al features.
There is a new c++ standard on the way a Microsoft will update its language to comply with the standard.
The new c++ standard cover most of the syntax needed to make use of CLR features, but not all.
käµfm³d 👽Commented:
C# it was designed to be very similar to c++
By that I hope you mean in syntax. C# is closer to Java than C++.
käµfm³d 👽Commented:
Delta expressions
Did you mean "lambda" expressions?

Anonymous delegates
Isn't a function pointer effectively the same thing?

Unsafe mode
Would it not be fair to say that the whole of C++ is "unsafe mode"?
Easwaran ParamasivamAuthor Commented:
Jaime OlivaresSoftware ArchitectCommented:
@kaufmed, you are right! it is lambda. I was writting very fast.
Anonymous delegates are not the same, because they can be used inline without declaring a function.
Yes, C++ runs basically in unsafe mode, but C# can work on a mixed mode (managed and unsafe) even on the same method.
Jacques Bourgeois (James Burger)PresidentCommented:
C++ and C were creating security problems because of their use of pointers. So Microsoft decided to forbid pointers in .NET (managed code).

Java was already a language that was similar to C++ without pointers, and that could have solved the problem. But Java is not optimized for any platform and thus has limitations in most operating systems, including Windows. A few years ago, Microsoft tried to create a "Java for Windows" called J++. But Sun, that had the rights to Java at that time, prevented them to do so.

C# is the answer to those problems. A language similar to C++ that has all the good features of C++, without the bad ones (pointers, multiple inheritance), and that has the main feature of Java (multi-platform) while being optimized for Windows.
käµfm³d 👽Commented:
A few years ago, Microsoft tried to create a "Java for Windows" called J++.
I thought it was called "J#". Was there a "J++"?

[edit]Never mind. Apparently there was both.[/edit]
I am not agree with you. All the features you give in your post are not c# features, they are IL Net features. Some of the features you describe are imperative for any language with support for CLR engine (garbage collector), so C++ CLI have it.
You need to take a look to last standard, not implemented yet by any one. I don’t understand why people think there must be a unique alternative that is best, can’t be even alternatives?.
I do believe that VB.NET and C# are even alternatives for programming in NET framework. Some people like me will prefer the verboseness of VB.NET and other will prefer the sharpness of C#.
There is something that everybody is missing with the new C++ you might lose access to some of the IL Net features but you can program almost in any machine or environment.
C# is the answer to those problems
How old are you?, there is not a definitive answer in IT. Problems only show up when anyone “have a solution”.
This question was not fair because the person who asked was in the side of c# lovers.
Jaime OlivaresSoftware ArchitectCommented:
Please read carefully, it stated "c# versus pure C++".
Regarding C++/CLI,  try to write a lambda expression, use Linq, extension methods or the dynamic operator with C++/CLI (please add them to my list above), and tell me it is the same in C++/CLI because all them are IL features.
There are idiomatic expressions in C# that are exclusive to C#. In some cases, they are incorporated lately in other languages (this has happened recurrently with VB.net) but it doesn't look as readable as with C#, which is, btw, a native .net language, not an adapted language.
I didn’t say that c++ CLI has support for all the features of the IL.
but it doesn't look as readable as with C#
That is another opinion.
a native .net language
Can you give me a link where Microsoft stated what you are saying? (Please…. ;-))
not an adapted language
All programming languages are always adapting its syntax to new required expression. A language is just a set of syntax rules; don’t give a language more importance that it really has.
The component that might make the difference between NET languages is the compiler (language->IL)

Ten un buen día! ;-)))))))))))))
Jaime OlivaresSoftware ArchitectCommented:
Thanks for sharing your opinions about my opinions.
Jacques Bourgeois (James Burger)PresidentCommented:

J++ came somewhere at the beginning or middle of the 90s as a "Java for Windows". But Sun slammed Microsoft in court, and it was removed from the market a couple of years later.

J# came with the first versions of .NET as a way to lure Java programmers to Visual Studio. But it never really catched on (with C# being so close to Java) and Microsoft stopped shipping it with VS in 2008 or 2010. My understanding is that it is still supported however.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.