C # Advanced Programming (i)-. NET Architecture

Source: Internet
Author: User

1.1 The relationship between C # and. Net

C # cannot be used in isolation and must be considered together with the. NET Framework.

(1) The architecture and methodology of C # reflects. NET basic methodology.

(2) In most cases, the language-specific functionality of C # depends. NET functionality, or depends on the. NET base class.

. NET supports some of the features that C # does not support. Other features supported by the C # language. NET but not supported.

1.2 Common language Runtime (CLR)

1.2.1 Platform Independence

The core of the. NET Framework is its runtime environment, called the Common Language Runtime (CLR) or. NET Runtime.

Typically, code that runs under the control of the CLR is called managed (managed code).

. NET to compile the code:

Phase one: Compile the source code into Microsoft intermediate Language (IL).

*il is similar to bytecode in Java.

Phase two: The CLR compiles IL into platform-specific code.

1.2.2 Improve Performance

JIT (Just-in-time compilation) is compiled only when the application is running, so Jil knows exactly what type of processor The program is running on, and it can be optimized for that processor to improve performance.

1.2.3 Language Interoperability

Visual Basic 2013,visual C + + 2013,visual f#,com and Com+,windows runtime.

1.3 Intermediate languages

Key features of the intermediate language:


      • interoperability of languages

      • reference type (reference type), variable only stores address, Instances of reference types are always stored in a memory area called the managed heap.

      • coercion typed

      • The real meaning of language interoperability classes written in one language should be able to communicate directly with classes written in another language. (The visual Studio IDE) provides such a tool (not the CLR).

      • object-oriented and use interface

The importance of strong data typing in language interoperability

If a class derives or contains an instance of another class, it needs to know all the data types used by other classes, which is why language interoperability is very important.

. NET Solutions



      • Universal type System (CTS)



The CTS defines predefined data types that can be used in intermediate languages, and all languages that target the. NET framework can generate compiled code that is ultimately based on these types.

The CTS also allows you to define your own type of code.

The hierarchical structure of the CTS reflects an object-oriented approach to the unitary inheritance of intermediate languages.


      • Common Language Specification (CLS)


Writing non-CLS will be acceptable in code, but after doing so we cannot guarantee that the compiled IL code fully supports the interoperability of languages.

      • garbage collection

      • security

      • application domain

      • Check the managed heap for objects that are not referenced and delete them.

      • using exceptions to handle errors

      • using attributes (attribute)

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.