Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-467.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4079595e82b982eabb07d94b04ae64fdcd9ef6c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;

public class ExceptionWithAnonMethod
{
	public delegate void EmptyCallback();
    	static string res;
	
	public static int Main()
	{
		try {
			throw new Exception("e is afraid to enter anonymous land");
		} catch(Exception e) {
			AnonHandler(delegate {
				Console.WriteLine(e.Message); 
				res = e.Message;
			});
		}
		if (res == "e is afraid to enter anonymous land"){
		    Console.WriteLine ("Test passed");
		    return 0;
		}
		Console.WriteLine ("Test failed");
		return 1;
	}

	public static void AnonHandler(EmptyCallback handler)
	{
		if(handler != null) {
			handler();
		}
	}
}