2 using System.Runtime.InteropServices;
3 using System.Reflection;
7 public static void TestA ([Optional][DefaultParameterValue (1)] int u)
11 public static void TestB (long u = 12)
15 public static void TestC (decimal d = decimal.MaxValue)
19 public static int Main ()
21 ParameterInfo[] info = typeof (C).GetMethod ("TestA").GetParameters ();
23 if (info[0].DefaultValue.GetType () != typeof (int))
26 if ((int) info[0].DefaultValue != 1)
29 if (!info[0].IsOptional)
32 info = typeof (C).GetMethod ("TestB").GetParameters ();
34 if (info[0].DefaultValue.GetType () != typeof (long))
37 if ((long) info[0].DefaultValue != 12)
40 if (!info[0].IsOptional)
43 info = typeof (C).GetMethod ("TestC").GetParameters ();
45 if (info[0].DefaultValue.GetType () != typeof (decimal))
48 if ((decimal) info[0].DefaultValue != decimal.MaxValue)
51 if (!info[0].IsOptional)
54 Console.WriteLine ("ok");