C # basic knowledge (IV). C # Introduction and managed code

Source: Internet
Author: User
Tags hosting

The summer vacation is fleeting. From the ten-day education to the one-week tour of Jiangsu, Zhejiang, and Shanghai, I have experienced many things and learned many things during this long summer vacation, I also realized many shortcomings! In my spare time, I want to further consolidate C # related knowledge, including C # entry-level knowledge, C # concurrent development, and ASP websites. this article introduces Karli Watson, author of the book C # Getting Started classic (beginning C. it mainly includes some of my own lack of C # Introduction knowledge and managed code content. the content is relatively simple. There are many references to this book, which is equivalent to your online notes!

Introduction to C # Getting Started classic:
Chapter 01-14 C # language: C # Introduction and relationship with. net, syntax, and OOP
Chapter 15-17 windows programming: using various. NET Framework controls
Chapter 18-20 Web programming: Using ASP. NET to execute tasks, Ajax
Chapter 21-24 Data Access: data storage disk, XML, and LINQ
Chapter 25-27 other technologies: WPF, WCF, Wf

1. Procedure for creating a. NET application

To create a. NET application, perform the following four steps:
1. Use a certain. Net compatible language (such as C #) to write application code


2. Compile the code into a pencil and store it in a set of programs.

3. When executing code (the executable file runs automatically or other code uses it), you must first compile the code as local code using the JIT compiler.

4. Run the local code and other applications or processes in the managed CLR Environment

Ii. managed code

First, let's briefly explain the terms above.
When using the. NET Framework library to compile and use the code, it is not to immediately create the Local Code dedicated to the operating system, but to compile the code into the common intermediate language (CER) code.
The task of JIT just-in-time compiler is to compile the Server Load balancer into the local code dedicated to the OS and the target machine structure before the OS can execute the application.
CLR
Common Language Runtime: manages the execution of all applications developed with the. NET library.
When compiling an application in an assembly, the created cilcode is stored in a program concentration. The Library (. dll) used by the Program Package for executable Application Files (.exe) and other applications ).

In the past, code was often compiled into several applications. Each application is used for a specific OS and CPU structure. Now, the JIT compiler uses the pencil Code (the pencil code is independent of the computer, OS, and CPU) compile as local code.
After the managed Code compiles the code into a pencil, and then uses the JIT compiler to compile it into the local code, the CLR (Common Language Runtime Library) tasks are not all completed, and the ongoing use of the managed code is also managed.. NET Framework ). that is, the CLR manages applications by managing memory, processing security, and allowing for language debugging. conversely, applications that are not controlled by CLR belong to an unmanaged type.
In other words:
Managed code is the code executed by the Common Language Runtime Library CLR environment rather than the operating system.
Unmanaged code is the Code directly executed by the operating system outside the public Language Runtime Library environment.
Unmanaged code must provide its own garbage collection, type check, security support, and other services, and managed code obtains these services from the CLR environment.
For example, for non-hosted types such as C ++ memory management and allocation, call the constructor and release the memory after use. however, in C #, only code running in the hosting environment can be compiled.. NET and OS.
The difference between the two can refer to the http://bbs.csdn.net/topics/330164764
The most important function of the garbage collection hosting code is the garbage collection. the. NET method ensures that the memory is completely released when the application no longer uses some memory. periodically checks the computer memory to delete unnecessary content.

III. C # compile an application

C # the. NET Framework does not limit the types of applications. Common application types are as follows:
1. Windows Applications
These applications (such as Microsoft Office) are familiar with Windows appearance and operation methods.. NET Framework Windows Forms module (a control library where controls such as buttons can be used to create Windows User Interface UI) can generate such applications. you can also use Windows Presentation Foundation to create more flexible and superior Windows applications.
2. Web Applications
Some web pages can be viewed in any web browser. its. NET framework includes a powerful system that dynamically generates web content, allowing personalization and security. this system is called Active Server Pages. net (Asp.. Net), use C # To create ASP.. NET application. you can also use Silverlight to write applications that run in a browser. (Next we will learn what we need to study)
3. Web Services
This is a new way to create distributed applications. You can use web services to exchange data over the Internet. You can also use advanced features to create a Windows Communication Foundation Service.
Add some concepts, such:

Summary: This article focuses on the basic introduction of C # knowledge and hosting Code. For more information, see C # Getting Started classic. We recommend that you learn C # Getting Started books. at the same time, I will describe some basic knowledge about my own weaknesses and explain some knowledge based on what I want to do.If you have any errors or deficiencies, please try again! Experts fly ~
(By: eastmount original csdn http://blog.csdn.net/eastmount)

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.