Executing Managed Code
Now that you know how types can be built and how IL code and metadata can be generated, either at compile time or at runtime, we should take a closer look at the execution model for managed code.
Consider the following fragment of C# code, which implements and uses a simple Calculator class. If the language constructs used here look foreign to you, don’t worry; we cover the syntax and meaning of C# programs extensively throughout the book.
The Main
method in the class Program
is where the execution of the program starts. First, a random-number generator is created that is subsequently used to generate two integer values, ...
Get C# 4.0 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.