private static List <CustomAttributeTypedArgument> WrapConstructorArgs(object[] args, MethodSignature sig) { List <CustomAttributeTypedArgument> list = new List <CustomAttributeTypedArgument>(); for (int i = 0; i < args.Length; i++) { list.Add(new CustomAttributeTypedArgument(sig.GetParameterType(i), args[i])); } return(list); }
private static IList <CustomAttributeTypedArgument> ReadConstructorArguments(Module context, ByteReader br, ConstructorInfo constructor) { MethodSignature sig = constructor.MethodSignature; int count = sig.GetParameterCount(); List <CustomAttributeTypedArgument> list = new List <CustomAttributeTypedArgument>(count); for (int i = 0; i < count; i++) { list.Add(ReadFixedArg(context, br, sig.GetParameterType(i))); } return(list.AsReadOnly()); }
private static int MatchSignatures(MethodBase mb1, MethodBase mb2, Type[] types) { MethodSignature sig1 = mb1.MethodSignature; MethodSignature sig2 = mb2.MethodSignature; IGenericBinder gb1 = mb1 as IGenericBinder ?? mb1.DeclaringType; IGenericBinder gb2 = mb2 as IGenericBinder ?? mb2.DeclaringType; for (int i = 0; i < sig1.GetParameterCount(); i++) { Type type1 = sig1.GetParameterType(gb1, i); Type type2 = sig2.GetParameterType(gb2, i); if (type1 != type2) { return(MatchTypes(type1, type2, types[i])); } } return(0); }