Why should you add C# to your skill set?

Microsoft foresees C# becoming as ubiquitous as Java. This should be reason enough to learn the language, but other compelling reasons exist as well.
Written by Shawn Dillon, Contributor
Microsoft decided it couldn't beat Java, so it created C#. The similarities between the two languages are striking. Microsoft foresees C# becoming as ubiquitous as Java, which has been called the “mother language” of the .NET initiative. This should be reason enough to learn the language, but other compelling reasons exist as well. In this article, I'll run through some of the benefits that C# has to offer.
Becoming an industry standard
The European Computer Manufacturer’s Association (ECMA) ratified the C# language specification (ECMA-334) as a standard on Oct. 13, 2001, and has placed this standard on a fast-track process for ISO approval. Originally, the C# language was developed within Microsoft as part of its .NET initiative and jointly submitted for standardization by Microsoft, Intel, and Hewlett-Packard.
The C# language specification itself is interesting in that it was designed to be not only platform agnostic, but also, in many respects, runtime agnostic. As long as the implementation supports the types and functionality described in the specification, a C# compiler can be designed to run on almost any runtime architecture. In fact, some early third-party implementations compile C# directly to Java byte-code. One such implementation is available at halcyonsoft.com.
For program portability, rather than source-code portability, the C# language specification is best combined with another ECMA standard known as the Common Language Infrastructure (CLI). CLI is the heart and soul of .NET and the Common Language Runtime (CLR). The first released implementation of the C# compiler using the CLI is, not coincidentally, the Microsoft .NET Framework.
So it’s a standard—but what is it?
The designers of the C# language took advantage of what they had learned from C, C++, and Java development. They borrowed the best aspects of these languages to create a modern, object-oriented language without many of the drawbacks and limitations of those other languages. In many areas, some often-misused or misunderstood language features were removed or “guarded” in C# to make the language easy and safe for the average developer.
For example, C and C++ can directly manipulate memory through the use of pointers. This capability is often necessary for high-performance programs, but it is also a source of numerous bugs and memory leaks when used incorrectly. Realizing the importance of pointer manipulation, the language designers ensured that this capability is also present in C#. But to prevent misuse and to make certain that your intent is preserved, this feature is designed so that you must explicitly invoke this capability in a C# program through the use of the “fixed” and “unsafe” keywords.
As an object-oriented language, C# excels. The C# language has first-class support for the concept of properties (data members) and other common elements of object-oriented programming. In C, C++, and Java, a get/set method naming convention is often used to express the concept of properties. (And under the hood, the CLI still translates property declarations to get/set methods for maximum interoperability with other languages.) In addition to property declarations, C# inherently supports events, declared value and reference types, operator overloading, and delegates (similar in functionality to C/C++ function pointers).
Managed code
Using the Microsoft implementation, C# programs always produce managed code. This simply means that the result of compilation produces a program containing embedded CIL instructions rather than native machine instructions. The CIL—also referred to as Microsoft Intermediate Language (MSIL) or sometimes simply as IL—is similar in concept to Java’s byte-code and consists of the set of low-level instructions understood by CLI-compliant runtimes like Microsoft’s CLR.
These programs are called managed code because the CLR is responsible for converting these instructions to machine-executable code and handles most of the infrastructure services for the code, such as garbage collection, heap and object lifetime management, and type verification. However, since you can manipulate pointers and memory directly within a C# program, not all C# programs are verifiably type-safe. Programs that use these guarded features still run within the context of the CLR and use managed resources, but their use means that the developer has taken on some memory management responsibilities and has explicitly informed the compiler that this was their intent.

Learning curve
Anyone who has some background in C, C++, or Java will have no problem learning C#. Even developers who have a basic familiarity with JavaScript and some other typed language, such as Visual Basic, will find the transition to C# fairly smooth and intuitive. In my opinion, C# beats Visual Basic .NET as far as usability because the C# language is much less verbose. Even complex programs appear more readable, concise, and elegant. And C# offers features that Visual Basic does not support, such as unsigned integers, operator overloading, and stronger type safety.
The main learning curve when deciding to use any .NET-supported language lies in learning the Base Class Library (BCL) of the Microsoft .NET Framework. C# itself has only 77 keywords, and the syntax is familiar and intuitive to many programmers. The BCL, in contrast, contains over 4,500 classes and innumerable methods and properties, which you will use in your C# programs to accomplish the tasks at hand.
For me, the only downside to learning C# was that some language features I’m used to were removed or have not yet been implemented. For example, in C# there is no support for multiple inheritance (MI) object hierarchies. This was a conscious decision on the part of the language designers because MI is often misused, and there are alternatives that are often much better designs. Instead of MI, a C# class inherits functionality from only one base class but may implement as many interfaces as it supports.
Another missing feature, but one that will be supported in later versions, is the concept of generics. (C++ programmers will know this as templates.) Research is currently under way to add this support to both the CLI and C# specifications.
A valuable skill
C# promises to be a valuable addition to any developer’s toolbox in the near and foreseeable future. Standardization of the language and class libraries will ensure that your skills will be useful across a variety of platforms, and the language features and capabilities offer compelling reasons to begin using it in your development today.

Editorial standards