Clr basics (1), clr basics (

Source: Internet
Author: User

Clr basics (1), clr basics (

The managed code compiled by C # is managed by the Common Language Runtime (CLR). Therefore, to run C # programs, you must install the. NET Framework on your computer. To check whether the. NET Framework has been installed, check whether the mscoree. dll file exists in the system directory (C: \ Windows \ System32, if the drive C is a system disk. This file exists, indicating that. NET Framework is installed.

 

If you want to know which versions of. NET Framework are installed on a machine, you can check the subitem of the registry key ("run" => enter regedit:
HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ NET Framework Setup \ NDP

 

According to my tests, you can also view all the. NET Framework versions installed on your computer in this directory:
C: \ WINDOWS \ Microsoft. NET \ Framework
. NET Framework 2.0 is provided in Windows XP and later versions.

The managed Assembly contains metadata and IL (intermediate language ). IL is a machine language unrelated to the CPU. It is more advanced than most CPU machine languages. IL can access and operate on object types, and provides commands to create and initialize objects, call Virtual Methods on objects, and directly operate on array elements, it also provides commands to throw and capture exceptions to handle errors. IL can be considered as an object-oriented machine language.
Prior to executing the hosted code, the clr jit (just-in-time or "instant") compiler will convert the IL conversion cost-based CPU commands corresponding to the hosted code. When you compile a CPU command at a cost, the CLR verifies the IL Code to ensure that all the code is secure. For example, it verifies whether the number of parameters for the method to call is correct and whether the parameter type is correct, whether the returned value is correct.
The. NET framework ngen.exe tool can compile the IL code at a cost. After the code is compiled, the clr jit compiler does not need to compile the IL code at runtime, which improves the performance of the application, such as speeding up application startup.
In CLR, type is the foundation of CLR, so there must be a "general type system", that is, CTS. CTS specifies access rules for Type Visibility rules and type members:
Private: A member can only be accessed by other members of the same class type.
Protected: A member can be accessed by a derived type, regardless of whether the type is in the same set
Internal: Members can be accessed by any code in the same assembly.
Public: Members can be accessed by any code in any assembly.

Related Article

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.