4 using System
.Reflection
;
8 public static int Sum (params int[] args
)
11 foreach (int a
in args
)
19 public static int Main (string[] args
)
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
);