* TextControl.cs: Make this operation undoable.
[mono-project.git] / mono / tests / array-invoke.cs
blobfc58ad648b07619ee020863014a48bf2e5e0e4d3
1 namespace Test
3 using System;
4 using System.Reflection;
6 class Foo
8 public static int Sum (params int[] args)
10 int ret = 0;
11 foreach (int a in args)
12 ret += a;
13 return ret;
17 class TestInvokeArray
19 public static int Main (string[] args)
21 Foo f = new Foo ();
22 MethodInfo m = (MethodInfo) (f.GetType ().FindMembers (MemberTypes.All, BindingFlags.Public | BindingFlags.Static, Type.FilterName, "Sum"))[0];
23 int[] numbers = new int[3]{4, 5, 6};
24 object[] parms = new object[1]{numbers};
25 int sum = (int)m.Invoke (f, parms);
26 Console.WriteLine ("sum is " + sum);
28 if (sum != 15)
29 return 1;
31 return 0;