+ if (position > 0) {
+ Type t = methodb.GetParameterType (position - 1);
+ if (defaultValue != null && t != defaultValue.GetType ()) {
+ if(!t.IsEnum || t.UnderlyingSystemType != defaultValue.GetType ())
+ throw new ArgumentException ("Constant does not match the defined type.");
+ }
+ if (t.IsValueType && !t.IsPrimitive && !t.IsEnum && t != typeof (DateTime))
+ throw new ArgumentException ("" + t + " is not a supported constant type.");
+ }
+