. NET Framework programming-Architecture Overview of the Net Framework Development Platform (FCL, CTS, CLS)

Source: Internet
Author: User

. NET FrameworkProgramDesign-Architecture Overview of the Net Framework Development Platform (FCL, CTS, CLS)

(1) FCL (. netframeworkclasslibrary):. NET Framework class library

FCL contains thousands of types, which are organized by namespace according to their functions.

Various. NET languages only define some rules, and we need to call the type in FCL to a large extent in actual use. These types allow us to use less language knowledge to create rich programs.

CLR and FCL support the following applications:

(1) XML Web Services
(2) web forms
(3) Windows Forms
(4) Windows Cui (console application)
(5) Windows Services (Windows SCM-Service Control Manager-managed service programs)
(6) Component Library

(2) CTS (Common Type System) General Type System

Type is the basis of CLR. Microsoft defines a formal specification -- CTS to describe the definition and behavior of the type.

CTS defines access control items for types and type members.

CTS defines the type of behavior so that the language andCodeSeparation of Behavior: We can use C ++ to define our own types and members, or C # and VB. However, the type of behavior is absolutely identical, language-independent.

(3) CLS (Common Language Specification) Public Language Specification

[See the corresponding directory, for example, \ Microsoft Visual Studio. NET 2003 \ SDK \ V1.1 \ Tool developers guide \ Docs's partition I ubunture.doc]

To fully interact with other objects, regardless of the language in which these objects are implemented, objects must only disclose the common functions of all languages they must interact. To this end, the public language specification (CLS) is defined, which is a set of basic language functions required by many applications. The CLs rule defines a subset of a general-type system, that is, all rules that apply to a public-type system apply to CLs, unless more strict rules are defined in Cls. CLS enhances and ensures language interconnectivity by defining functions that are available in multiple languages. CLS also establishes CLS compliance requirements, which helps you determine whether your managed code complies with CLs and whether a given tool is responsible for hosted code (the Code uses the CLS function) the degree of development support.

If your component only uses the CLS function in Apis exposed to other code (including derived classes), you can ensure thatProgramming LanguageYou can access this component. Components that comply with the CLS rules and only use the functions contained in Cls are called CLS-compliant components.

[Http://msdn.microsoft.com/library/chs/default.asp? Url =/library/CHS/cpguide/html/cpconwritingcls-compliantcode.asp]

CLS must be followed if you want to develop a CLR-oriented compiler.

As shown in the figure:
CLR/CTS provides a set of features. Some languages provide a large subset of these features (IL provides all the features ). CLS is a minimal set of features that each language must support.

Using System;
// Check CLS compatibility
// CLR checks whether the common type members comply with the CLS feature.
[Assembly: clscompliant ( True )]
// Public Type is available, no error is reported
Public   Class APP ()
{
// Error: The response type of APP. ABC () is incompatible with Cls.
Public Uint32 ABC () {Return 0;}
// Error: CLS incompatibility caused by Case sensitivity
Public   Void ABC () {}
// Correct, because it is private
Private Uint32 ABC () {Return 0;}
}

(4) CTS and Cls are both components of the CLI (Common Language infrastructure public language infrastructure.

The basic elements of the CLI are:
· Cl: I
· Cts
· CLS
· VES (virtual execution system), which executes managed code and lies between the Code and the native Operating System

And these elements's relation (CLI, CTS, CLS)
:

Each programming language that complies with the CLI uses a subset of the common type system that is appropriate for that language. language-based tools communicate with each other and with the virtual execution system using metadata to define and reference the types used to construct the application. when a constructor is called to create an instance of an object, the VES uses the metadata to create instances of types, and to provide data type information to other parts of the infrastructure (remoting services, assembly downloading, security, etc .).
Ages and programming environments that do target the CLI-there are currently more than 20, and the list is growing-produce what is called Managed code And Managed Data . The key to these is Metadata -Information associated with the code and data that describes the data, identifies the locations of references to objects, and gives the VES enough information to handle most of the overhead associated with older programming models. this overhead includes des handling exceptions and security, and providing information to tools that can ensure memory safety. it may also include running on remote systems by creating proxies for the programmer, as well as managing object lifetime (called Garbage Collection ).

Among the things the CLI specifies are the following:

    • The common type system

    • The Common Language Specification for publicly available CILS

    • Metadata

    • Portable File Format for managed code

    • The common intermediate language (CEL) Instruction Set

    • Basic requirements of a virtual execution system

    • A programming framework built on top of all of this

The CLI also bridges the managed and unmanaged worlds. the CLI describes how, in the same program, managed modules can be run with unmanaged modules compiled in native code (machine code, specific to a given system ). this interoperation is also crucial to describing how modules can communicate though the VES with the underlying operating systems.

Come from 《Common Language infrastructure annotated Standard"

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.