1 // Compiler options: -langversion:future
4 using System.Runtime.InteropServices;
5 using System.Reflection;
9 public static void TestA ([Optional][DefaultParameterValue (1)] int u)
13 public static void TestB (long u = 12)
17 public static void TestC (decimal d = decimal.MaxValue)
21 public static int Main ()
23 ParameterInfo[] info = typeof (C).GetMethod ("TestA").GetParameters ();
25 if (info[0].DefaultValue.GetType () != typeof (int))
28 if ((int) info[0].DefaultValue != 1)
31 if (!info[0].IsOptional)
34 info = typeof (C).GetMethod ("TestB").GetParameters ();
36 if (info[0].DefaultValue.GetType () != typeof (int))
39 if ((int) info[0].DefaultValue != 12)
42 if (!info[0].IsOptional)
45 info = typeof (C).GetMethod ("TestC").GetParameters ();
47 if (info[0].DefaultValue.GetType () != typeof (decimal))
50 if ((decimal) info[0].DefaultValue != decimal.MaxValue)
53 if (!info[0].IsOptional)
56 Console.WriteLine ("ok");