O'Reilly logo

Applied Microsoft® .NET Framework Programming by Jeffrey Richter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How the Runtime Resolves Type References

At the beginning of Chapter 2, we saw the following source code:

public class App {
   static public void Main(System.String[] args) {
      System.Console.WriteLine("Hi");
   }
}

This code is compiled and built into an assembly, say App.exe. When you run this application, the CLR loads and initializes. Then the CLR reads the assembly’s CLR header looking for the MethodDefToken that identifies the application’s entry point method (Main). From the MethodDef metadata table, the offset within the file for the method’s IL code is located and JIT-compiled into native code, which includes having the code verified for type safety, and the native code starts executing. Following is the IL code for the Main method. To obtain ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required