- February 10, 2005 at 2:12 pm #1876willParticipant
What’s the point of C#?
There has been BCPL, C, and C++; Microsoft recently introduced yet another language in the same naming tradition: C# (pronounced “C sharp”). C# is a language designed to be fully compatible with Microsoft’s .NET initiative while taking advantage of what has been learned from C and C++ (as well as Java).
C# is designed to be a platform-independent language in the tradition of Java. It’s syntax is similar to C and C++ syntax, and C# is designed to be an object-oriented language. There are, for the most part, minor variations in syntax between C++ and C#. Main has no return type, there are no semicolons after class names, there are some (to C++ programmers) strange decisions regarding capitalization – such as the capitalisation of Main. Other a few differences, the syntax is often the same. This decision is reasonable, in light of the fact that C syntax has been used with several other languages – notably Java.
Similar to Java, C# does not support multiple inheritance; instead it provides Java’s solution: interfaces. Interfaces implemented by a class specify certain functions that the class is guaranteed to implement. Interfaces avoid the messy dangers of multiple inheritance while maintaining the ability to let several classes implement the same set of methods.
Another helpful feature of C# is garbage collection. Therefore, it is unnecessary to include a destructor for each class unless a class handles unmanaged resources; if so, it’s necessary to release control those resources from within the class (The Finalize function is used to clear up these unmanaged resources; it can even be abbreviated with the same syntax as a C++ destructor). Of course, C# also provides direct access to memory through C++ style pointers, but these pointers are not garbage collected until specificially released by the programmer.
C#, as part of the .NET framework, is compiled to Microsoft Intermediate Language (MSIL), which is a language similar to Java’s bytecode. MSIL allows C# to be platform independent and runs using just in time compiling. Therefore programs running under .NET gain speed with repeated use. Furthermore, because the other languages that make up the .NET platform (including VB and Cobol) compile to MSIL, it is possible for classes to be inherited across languages. The MSIL, like bytecode, is what allows C# to be platform independent.
The potential for C# is great if the .NET platform succeeds. C# is designed to take advantage of the design of .NET, and Microsoft has poured a great deal of money into .NET. Do you need to learn C#? If you know C++, you’ll probably be able to pick it up quickly, and yes, you can still use C++ with .NET. It’s important to keep an eye on C# to see how it will affect you.
Taken from http://www.cprogramming.com
- The forum ‘C# Programming’ is closed to new topics and replies.