All pastes #49555 Raw Edit

Untitled

public text v1 · immutable
#49555 ·published 2006-04-17 02:17 UTC
rendered paste body
using System;

class Driver
{
    public static void Main()
    {
        Console.WriteLine ("Starting Main");
        // Invoke a static method on Test
        Test.EchoAndReturn ("Echo!");
        Console.WriteLine ("After echo");
        // Reference a static member of Test
        string y = Test.x;
        // Use the value just to avoid compiler cleverness
        if (y != null)
            Console.WriteLine ("After field access");
    }
}

class Test
{
    public static string x = EchoAndReturn ("In type initializer");

    public static string EchoAndReturn (string s)
    {
        Console.WriteLine (s);
        return s;
    }
}