O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

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

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:

using System;static class Program{    static void Main()    {        var random = new Random();        int a = random.Next();        int b = random.Next();        var calc = new Calculator();        int sum = calc.Add(a, b);        Console.WriteLine("{0} ...

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