C# (pronounced C Sharp) Programming Language seems popular these days based on market trends. If you are working with .Net and ASP technologies, you are required to be familiar with the C# accurately. Here we will describes specifically what is similar, what is different, and the motivation behind the C# preference.
C# Programming Language
C# Programming Language is the prime language for Microsoft applications and services. It was designed & developed after the legal battle between Microsoft and Sun Microsystems (the developers of Java). Microsoft released first version of C# with Visual Studio 2002. MSDN introduces C# as
C# is an elegant and type-safe object-oriented language that enables developers to build a variety of secure and robust applications that run on the .NET Framework.
C# vs C++
Here are some C# properties that make it preferable over C++.
- It has native garbage-collection.
- It allows you to treat class-methods’ signatures as free functions (i.e. ignoring the statically typed this pointer argument), and hence create more dynamic and flexible relationships between classes.
- C# has a huge standard library with so much useful stuff that’s well-implemented and easy to use.
- It allows for both managed and native code blocks.
- Assembly versioning easily remedy DLL hell problems.
- You can set classes, methods and fields to be assembly-internal (which means they are accessible from anywhere within the DLL they’re declared in, but not from other assemblies).
C# vs Java
Some of the properties that makes C# better than Java.
- Instead of a lot of noise (EJB, private static class implementations, etc) you get elegant and friendly native constructs such as Properties and Events.
- You have real generics (not the bad casting joke that Java calls generics), and you can perform reflection on them.
- It supports native resource-management idioms (the using statement). Java 7 is also going to support this, but C# has had it for a way longer time.
- It doesn’t have checked exceptions.
- It has Lambdas and LINQ, therefore supporting a small amount of functional programming.
- It allows for both generic covariance and contravariance explicitly.
- It has dynamic variables, if you want them.
- Better enumeration support, with the yield statement.
- It allows you to define new value (or non-reference) types.
Although C# is better than Java in certain ways, but are so similar in most ways that once you have learned how to program in C#, it will be trivial to transfer your knowledge to Java. There is also a white paper documentation written by Kirk Radeck on MSDN as Learn about the differences between C# and Java where he discusses main difference between C# & Java & the benefits of them on each other.
The environment for your software is most important for choosing C#. If you work in an environment with Windows clients, Windows servers, Active Directory, IIS and maybe SQL Server then C# is the far best language with the .NET Framework. If you work in a Unix environment with e.g. web services, Java would be my choice. And if you work with embedded systems or have to integrate with hardware devices Java or C++ will be a good choice.