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

test-237.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 44efda93c692173700ba36b463643f71fdba76a1 (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
// Test for bug #56442

public class Params
{
	public static readonly object[] test       = new object[] { 1,         "foo",         3.14         };
	public static readonly object[] test_types = new object[] { typeof(int), typeof(string), typeof(double) };
	
	public delegate void FOO(string s, params object[] args);
	
	public static void foo(string s, params object[] args)
	{
		if (args.Length != test.Length)
			throw new System.Exception("Length mismatch during " + s + " invocation");
		for (int i = 0; i < args.Length; ++i)
			if (args[i].GetType() != test_types[i])
				throw new System.Exception("Type mismatch: " + args[i].GetType() + " vs. " + test_types[i]);
	}

	public static void Main()
	{
		foo("normal", test);
		FOO f = new FOO(foo);
		f("delegate", test);
	}
}