View C # Opening part through IL

Source: Internet
Author: User
View C # Through IL #
Opening

Address: http://www.cnblogs.com/AndersLiu/archive/2008/11/03/csharp-via-il.html

Author: Anders Liu

Abstract: This is a series of articles that introduce the representation of various language structures in C # after being translated into IL by the compiler, and analyze the principle from the perspective of IL.

Origin

Lao Liu is a real fan of. NET technology. However, I have been tired of pursuing. NET Technology for so many years. Computer technology, especially Microsoft technology, is changing rapidly and is insufficient to work. So Liu decided to move to the bottom layer.

If. NET technology, you will find that. NET 2.0, although frameworks and languages as well as other application-layer fields (such as WF, WCF, WPF, and Silverlight) are changing with each passing day, what words are used to represent the underlying technology? Let alone IL-it is very stable and basically remains unchanged.

The recently released Visual Studio 2010 CTP reflects this point even though the C # language has undergone great changes (providing stronger interaction with dynamic languages) and the Framework must be greatly updated, but I still haven't heard of any changes to IL. Therefore, learning IL may be easier than learning those application-layer technologies. Although it is more difficult, I can learn it slowly and savor it.

Old Liu is not a single-person. He has to share his studies with you. Liu not only shared what he learned, but also hoped to share with you the learning process.

I was going to write something similar to the IL tutorial, but I finally gave up. On MVP Open Day this year, I chatted with Anytao and TerryLee about this idea. We agree that such an article is meaningless. Yes. Who will use IL to write programs with so convenient development tools and so powerful languages? More people look at IL and use IL to understand some higher-level technologies and concepts.

Anytao suggests that you can write the IL corresponding to the C # language structure. This small suggestion gave Liu unlimited inspiration and triggered the formation of this series. Thank you!

Introduction

Through IL to see C #, what is this IL? In short, it is the ILAsm language.

What is ILAsm language? If you simply think it is an assembly or programming language, it is a big mistake. We can think of ILAsm as ". NET metadata ing language ". That is to say, ILAsm maps almost all the content of a hosted assembly, including the Assembly List, metadata, IL commands, and even managed resources, and PE image attributes.

This series of articles simply lists the IL code corresponding to various C # Syntax structures.

Who should read this series?

Lao liu wrote this series based solely on interest. If you are in a different mood with Liu, these essays are no longer suitable for you.

If you want to write a file similar to. NET
For anti-compilers like Reflector, in addition to being quite familiar with reflection and IL language, you must have a deep understanding of the IL command sequence modes corresponding to various C # Syntax structures. This correspondence can only come from a large amount of observation and accumulation. Sometimes, the same syntax structure only generates a completely different IL command sequence because of some context changes. Although this series of articles does not cover all these mappings, I believe it will give you some inspiration.

In addition, please first reduce your standards and expectations-this series of articles is very simple, just listing the IL code corresponding to various C # Syntax structures. If you are interested and have enough time, you can do this on your own. However, if you are a little interested in IL and don't want to spend too much time on research, these articles will bring you a lot of fun.

Note: Liu's writing has always been a stream of consciousness. The first article wrote the second article, I don't know when to come out, or I don't know how many articles to write, and I will look for him again. Therefore, do not look forward to it.

Here I borrow Han's sentence-you can scold me or not, but don't rush me.

Directory
  • View C # (1) Through IL -- switch statement (I)
  • View C # (2) through IL -- switch statement (below)
  • View C # Through IL (another article)-guard against constant traps
  • View the C # (3) -- foreach statement through IL

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.