About C # And. NET Framework,

Source: Internet
Author: User

About C # And. NET Framework,

A few days ago, a tester asked me what the. NET Framework is and what is the relationship with C.

Next I will explain what the. NET Framework is:. NET Framework is a Framework that is required when the application is running.Execution EnvironmentIt provides several services for application execution:

(1) Comprehensive Class Libraries: provide a wide range of class libraries for programmers to use, so that programmers can develop more efficiently.

(2) memory management: many other programming languages require programmers to allocate and release memory and manage object lifecycles. In the. NET Framework, programmers do not have to worry about memory issues (of course, this is not absolute) because it provides high-quality memory management services.

(3) Common Type System (CTS): defines the predefined data types that can be used in the intermediate language (IL, which will be explained later.

(4) development structure and technology:. NET Framework provides the libraries required for developing specific programs, such as WPF, WCF, and ASP. NET.

(5) language interoperability: In. the language compilers on the NET Framework all provide the mechanism for generating intermediate languages (IL, as for what is IL, the next article explains). This mechanism allows different languages to operate on each other.

The above is just a simple concept. Let's take a look at the composition of. NET Framework:

. NET Framework consists of two parts: Common Language Runtime (CLR) and. NET Framework Class Library (FCL ).

1. Common Language Runtime (CLR)

It is a. NET FrameworkCore Infrastructure.I think we can regard it as a container. In this container, it provides services such as memory management, thread management, exception handling, and check type security. The Code executed in it is calledManaged code(Managed code), the code not executed in it becomesUnmanaged code(Unmanaged code ). Generally, the code written by C # is managed code.

CLR consists of two components: Common Type System (CTS) and Common Language Specification (CLS ).

  • CTS: C # and VB. NET is two more commonly used languages. They are all managed by CLR, but they are different in terms of syntax and data type. How is CLR managed? CTS is used to solve this problem. It solves the problem of different data types between different languages. for example: C #, int is used to define Integer, while VB uses Integer, obviously, the two types can be changed to universal Int32 through CTS. All. NET frameworks share this type of system so that they can achieve seamless interoperability.
  • CLS: as we mentioned earlier, CTS solves the difference in data types. CLS is used to solve the difference in syntax specifications. CLS is the lowest language standard, which specifies. NET platform is the minimum feature that the target language must support, as well as a language and other. NET Language. Recognizing this is very important. The feature issues discussed here are not just simple syntax differences between languages. For example, CLS does not focus on the keywords used to implement inheritance in a language. It only cares about how the language supports inheritance. CLS is a subset of CTS. This means that a language feature may comply with the CTS standards, but beyond the scope of CLS. For example, C # supports the unsigned numeric type. The feature can pass the CTS test, but CLS only recognizes the symbolic numeric type. Therefore, if you use the C # unsigned type in a component, you may not be able to use a language that does not use the unsigned type (such as VB.. NET.. NET component to achieve interoperability.

2... NET Framework class library (FCL)

It is a collection of DLL assembly, including a large number of defined types and functions. Programmers can use these functions to quickly develop a variety of applications, such as WPF, Windows Form, and ASP. NET applications.

A good explanation of the. NET Framework: what is in the red box is an integral part of the. NET Framework.

 

 

Next let's talk about the second question: what is the relationship between C # And. NET Framework?

In fact, the image above should be clearly explained. C # is a language for. NET Framework development. Besides C #, both VB. NET and F # are the same.

Let's make a classic analogy :. NET Framework is equivalent to an aircraft carrier. On this ship, it can be equipped with many types of aircraft, such as J 11 (C #) and D 8 (VB. NET), empty alarm 200 (F #), etc. Can all run on the. NET Framework aircraft carrier.

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.