Sams Teach Yourself C# in 24 Hours

Sams Teach Yourself C# in 24 Hours

By James Foxall and Wendy Haro-Chun

Common Language Runtime (CLR)

A language runtime is what allows an application to run on a target computer; it consists of code that is shared among all applications developed using a supported language. A runtime contains the "guts" of language code, such as code that draws forms to the screen, handles user input, and manages data. The runtime of .NET is called the Common Language Runtime (CLR).

Unlike runtimes for other languages, the CLR is designed as a multilanguage runtime. For example, C# and Visual Basic both use the CLR. In fact, currently more than 15 language compilers are being developed to use the CLR.

Because all .NET languages share the CLR, they share the same IDE, the same forms engine, the same exception-handling mechanism, the same garbage collector (discussed shortly), and much more. One benefit of the multilanguage capability of the CLR is that programmers can leverage their knowledge of a given .NET language. For example, some developers on a team may be comfortable with C#, whereas others are more comfortable with Visual Basic. Because both languages share the same runtime, both can be integrated to deliver a solution. In addition, a common exception-handling mechanism is built into the CLR so that exceptions can be thrown from code written in one language and caught in code written in another .NET language.

Another advantage of the CLR is that all .NET tools share the same debugging and code-profiling tools. In the past, languages such as Visual Basic were limited to their own debugging tools, whereas languages such as C++ had many third-party debugging tools available. Now, all languages share the same tools. This means that as advancements are made to the debugging tools of one product, they're made to tools of all products because the tools are shared. This aspect goes beyond debugging tools. For example, add-ins to the IDE (such as code managers) are just as readily available to C# as they are to Visual Basic—or any other .NET language, for that matter.

Share ThisShare This

Informit Network