[You must know. NET] The 14th time: Understanding IL code---from start to present

Source: Internet
Author: User

This article describes the following:

· Il Code Analysis method

· Il command parsing

·. NET Learning Methodology

1. Introduction

Since the beginning of the "You must know. NET" series, we have received a lot of attention and support from all of you, giving Anytao great encouragement and impetus. In the past, I found that many of the garden friends look and focus on how to understand the IL code this issue. For me, this is really a great news, because it is clear that our ideas slowly from the application to the bottom of the change, the technical things are an accumulation of aspects, the bottom of the exploration in my opinion is also essential to the cultivation. If we choose to focus on this discipline, then we should choose how to proceed with this discipline, first of all, to focus on the Anytao "you must know. NET" Series can provide you with a shortcut, less effort, and second, the master of the work should be more in-depth understanding, such as the "applied Microsoft. NET Framework Programming, ". NET essence theory; again, just like me, growing from the blog Park and the MSDN Knowledgebase. Oh, in addition to making an ad for myself, I think no matter what the way to know and understand the IL code, for our more profound understanding. NET and. NET application of the essence of a different harvest, which is the reason for this article research and share.

So, to understand the IL code, it's important to know the benefits of IL, which is valuable to every programmer, and you have to be aware of the value of your investment and decide which capital to invest in. For. NET programmer, IL code means:

• The common language base is. NET operation, when we have objections to the results of the program running, how to look at the surface through the essence, we need to explore from the essence, then IL is the basis you must know;

• Metadata and Il languages are the foundations of the CLR, and understanding the necessary intermediate language is a shortcut to understanding the CLR;

• A large number of case studies are revealed by IL, so understanding IL is the essential basis for reading other people's code, and can be more rewarding.

It is clear that these advantages are enough to tempt us to spend time and energy dabbling in them. However, understanding the benefits of IL does not mean that we should be overly concerned with IL, someone can even write a bunch of IL code to implement a simple Hello World program, but as we know, program design has gone through decades of development, if pure intoxication in history, There is no other explanation except for the bad brain. otherwise see any code in the perspective of IL analysis, and will go into another misunderstanding, our aim is to pursue but not too much.

Therefore, with the above reasons should be understood and should not be too much of the baseline, in the premise of positive attitude, this article began to do in the author's view of the IL code of the understanding, the author hopes that through the elaboration and analysis of this article so that everyone can have an overview of the IL, and use this method in peacetime project practice to understand. NET by understanding your own code. I think that this method should be worthy of promotion and play the best practice, I do not know you believe it? Oh.

2. Using Tools

As the saying goes, 工欲善其事, its prerequisite. The main elements of IL are ILadsm.exe and reflector.exe, both of which are the basis for understanding IL, and the principle is to view the IL code through the reflection mechanism.

· ILadsm.exe

Open the. NET Framework SKD command Prompt line, enter ILDASM carriage return to open, as shown in the figure:

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.