首页 > 代码库 > C# to IL 4 Keywords and Operators(关键字和操作符)

C# to IL 4 Keywords and Operators(关键字和操作符)

Code that is placed after the return statement never gets executed. In the first program
given below, you will notice that there is a WriteLine function call in C# but is not visible in
our IL code. This is because the compiler is aware that any statements after return is not
executed and hence, it serves no purpose to convert it into IL.

技术分享

技术分享

The compiler does not waste time compiling code that will never get executed, instead
generates a warning when it encounters such a situation.

技术分享

技术分享

技术分享

If a constructor is not present in the source code, a constructor with no parameters gets
generated. If a constructor is present, the one with no parameters is eliminated from the
code.
The base class constructor always gets called without any parameters and it gets called
first. The above IL code proves this fact.

 技术分享

技术分享

技术分享

We may write a namespace within a namespace, but the compiler converts it all into one
namespace in the IL file. Thus, the two namespaces vijay and mukhi in the C# file get
merged into a single namespace vijay.mukhi in the IL file.

C# to IL 4 Keywords and Operators(关键字和操作符)