Manage Learn to apply best practices and optimize your operations.

The common language runtime

Definitions and explanations about the common language runtime (CLR) in the .NET framework.

.NET Developer Tip
(Receive this column in your inbox,
click Edit your Profile to subscribe.)

The common language runtime
Peter G. Aitken and Phil Syme

If you haven't done any development for the .NET environment, chances are that you need to understand some basic terms about the concept. This tip, excerpted from InformIT, offers some definitions and explanations about the common language runtime (CLR) in the .NET framework.

The common language runtime (CLR) is the infrastructure that .NET uses to execute all your applications. The CLR includes a huge set of class libraries that you can use in your applications. Some interesting non-Internet–related classes include utilities that allow you to manipulate the Windows NT event log, Active Directory, cryptographic services, performance counters, COM+ services, object serialization, and Windows native services.

The CLR also takes care of compiling "intermediate language," or IL, code into native machine code. The basic process works as follows:

The Visual Basic compiler converts your code into IL. In terms of functionality and language complexity, IL is somewhere between assembly language and C. IL is optimized for quick compilation into machine code. Normally, you won't deal with IL in any of your development efforts. You can think of IL as an intermediate product of the compilation process.

Your Internet application is called by a user, or more precisely, by the Web server in response to a user's request.

The CLR takes over and compiles the IL into machine code. This happens function by function. If a function is used, it's compiled into machine code. If not, it remains as IL. The odds of an error occurring during this process are extremely small, equivalent to a compiler crash.

If this process seems roundabout and destined to make your application too slow, please suspend judgment until you've worked with .NET for a little while. You should be pleasantly surprised. At the minimum, this process makes development much faster, as the first step is much faster than other methods. You can also compile your .NET code directly into machine code by using standard tools installed with the .NET Framework.

The CLR contains other services, including support for running multiple .NET applications inside one process with a guarantee that they won't interfere with each other. This is a result of a concept called type safety. Any .NET language must guarantee type-safe code, which ensures that arrays and collections will never be accessed incorrectly, among other things. The Visual Basic compiler always enforces type safety when it compiles your code into IL.

To read the article from which this tip is excerpted, click over to InformIT. You have to register there, but the registration is free.

For More Information:

  • Looking for free research? Browse our comprehensive White Papers section by topic, author or keyword.
  • Are you tired of technospeak? The Web Services Advisor column uses plain talk without the hype.
  • For insightful opinion and commentary from today's industry leaders, read our Guest Commentary columns.
  • Hey Codeheads! Start benefiting from other time-saving XML Developer Tips and .NET Developer Tips.
  • Visit our huge Best Web Links for Web Services collection for the freshest editor-selected resources.
  • Choking on the alphabet soup of industry acronyms? Visit our helpful Glossary for the latest lingo.
  • Visit Ask the Experts for answers to your Web services, SOAP, WSDL, XML, .NET, Java and EAI questions.
  • Discuss this issue, voice your opinion or just talk with your peers in the SearchWebServices Discussion Forums.

Dig Deeper on Topics Archive

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.