Hello LCG

The LCG Hello World example is shown here, simply printing “Hello LCG!” to the screen based on a dynamically generated assembly:

image

From this code, you can see all the layering surrounding code on the CLR. On the top level, we find assemblies that are containers for one or more modules. Inside those modules, we can define types that by themselves contain members. Notice methods can also be declared outside types, as global methods, but this is not directly supported by some languages like C#. The preceding code is the equivalent to the following code compiled into an assembly called LCGDemo:

class Sample{    public static void SayHello() ...

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.