What is. Net CLR

Source: Internet
Author: User
Tags virtual environment
    This article mainly introduces what. Net CLR is. The two legends allow you to clearly understand the differences between C # And. Net CLR. What services does CLR provide for developers and give you a deep understanding of the mysteries.

     

    The first thing you need to know is that the. NET platform and C # are not the same. You must understand that there are two concepts for developers. First, it is a platform for C #, VB.net, and other programs to run. Second, it provides a wide range of class libraries (called base class libraries) for these languages. Let's take a look at what. Net CLR is.

    Net CLR

    For a person who wants to develop the. NET platform, it is very necessary to understand the entire structure of the. NET platform. 1 shows the overall structure of the. NET platform:

    This figure is famous. ,. net Framework is in Microsoft. the basis for development on the net platform, Asp. net, Windows Forms, and. net is.. NET platform development, which is used.. NET application development and display .. NET platform's core technologies include: Common Language Runtime (CLR: Common Language runtiome), base class library (BCL: Base Class Library),. Net Language, and Visual Studio. NET

    As shown in this figure ,. net Framework is a virtual operating platform based on windows. You can think of replacing Windows with other operating systems, such as Linux, in the same way, CLS (Common Language Specification, general language specification) can be used. NET language, (VB. net, C #, JScript. to create ASP. NET. net or Windows form (may be called Linux forms) application functions, which are actually the functions to be implemented by mono. Therefore, in theory, C # is a cross-platform language, which is similar to Java. C # Another thing that is more similar to Java is that it is also a (special) language, just like Java, C # the program code written in C # is first compiled into a special byte code (Microsoft intermediate language, msil, Microsoft) using the C # compiler, at runtime, It is compiled into machine code by a specific compiler (JIT compiler, just in time, jiter) for execution by the operating system.
    Not only C # language, all. net Language (which will include dozens of common modern coding languages) can be used to write CLR-oriented program code. net is called managed code. All managed code runs directly on the CLR and has platform-independent features.

    The explanatory language is safe and can be granted with more functions through its operating platform, such as automatic memory management and Exception Handling. In fact, many features of C # are provided by CLR. the CLR structure diagram shown in 2 illustrates this.

    As shown in figure 2, many features of C # are provided by CLR, such as type checker, garbage collector, and exception manager), backward compatibility (COM), etc. Specifically ,. the CLR on net provides the following services for developers:
    ◆ Platform independence: CLR actually provides a product that uses virtual machine technology. It is built on the operating system and does not require that the running platform of the program be windows, any system that supports its Runtime Library can run on it.. NET application. Therefore, an application fully composed of managed code can run on any platform that supports. Net once compiled.
    ◆ Cross-language integration: CLR sequential development is developed in any language. Code developed in these languages can be closely and seamlessly used for cross-call in the CLR environment, for example, you can use VB to declare a base class object, and then directly create a base class derived class in the C # code.
    ◆ Automatic Memory Management: CLR provides a collection mechanism to automatically manage memory. When the lifecycle of an object or variable is completed, the CLR Automatically releases the memory they occupy.
    ◆ Cross-Language Processing
    ◆ Version Control
    ◆. Net Security
    ◆ Simple component interoperability.
    ◆ Self-description component: a self-description component is an execution file that stores all data and code in one file. The self-describing component can greatly simplify system development and configuration, and improve system reliability.

    The Common Language Runtime (CLR) was first called the next-generation Windows service runtime (ngws runtime ). it is a virtual environment directly built on the operating system, and the main task is to manage code running. CLR now supports dozens of modern programming languages to write code for it, and then is executed in the form of an intermediate language (intermediate langeoage, il) code. In addition, CLR provides many features to simplify code development and application configuration, while also improving application reliability. As you know, if the compiler of a language aims at runtime, the code generated by using the language can be found in. net is called managed code, because such code runs directly on the CLR, so it has platform-independent characteristics.

    In. in the net platform structure, the top of the CLR is. net base class library. This base class library provides a unified, object-oriented, hierarchical, and scalable programming interface from basic input and output to data access. From. NET platform structure, you can also see that the base class library can be called and extended by various languages, that is, whether it is C #, VB. net or VC ++. net, can be freely called ,. net class library, because C # Only has 77 keywords, And the syntax does not have to work for programmers. BCL, on the contrary, contains more than 4500 classes and countless methods, attributes, which may be used at any time in your C # program to complete their own tasks.

    There is also a very important concept that you need to understand. This is the common language architecture (CLI ). CLI is a subset of CLR, that is. net is the most final part of managing the runtime environment of the application compiled into msil code. In the CLR structure, the CLI is located in the lower half, mainly including class loader and real-time Compiler (IL to native compilers) and a runtime environment for garbage collection and code written in any language, through its specific compiler into msil code and then run on it, you can even write msil on your own and run it on CLI. the above is the introduction. net CLR.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.