GenericParameter.cs: override Module properly
[mcs.git] / tests / test-anon-10.cs
blob065f7c2cae5bf95eb531e2809dfbb4114c486b7d
1 //
2 // This test exercises the access to a field instance from an instance
3 // method that has an anonymous method.
4 //
5 using System;
7 class S {
8 delegate void T ();
10 T t;
12 int f;
14 public void Test ()
16 // The loop just forces the creation of a helper class, so
17 // that the anonymous method is not placed side-by-side this
18 // method.
19 int a = 1;
20 for (int i = a; i < 10; i++){
21 int j = i;
22 t = delegate {
23 Console.WriteLine ("Before: {0} {1} {2}", f, i, j);
24 f = i;
29 static int Main ()
31 S s = new S ();
32 s.Test ();
33 s.t ();
34 if (s.f == 10)
35 return 0;
36 Console.WriteLine ("Failed:" + s.f);
37 return 1;