Hi JB,
looks good but I have some problems.
1. I found a way to get the System.Type, that is now working, so i
have one implementation.
2. Your code generates the following peverify error:
[MD]: Error: Signature has an invalid token (token: 0x020001ff;
offset: 0x00000002). [token:0x1B000001]
[MD]: Error: Signature has generic type of arity 0 instantiated at
different arity 1 at byte=0x00000005. [token:0x1B000001]
and ildasm says: IL_0009: call instance !0 class [ERROR:
INVALID TOKEN 0x020001FF] <int32>::getKey()
I had to change your second method to:
public static MethodReference MakeGeneric (this MethodReference self,
TypeReference declaringType)
{
var reference = new MethodReference(self.Name,self.ReturnType) {
DeclaringType = declaringType,
HasThis = self.HasThis,
ExplicitThis = self.ExplicitThis,
CallingConvention = MethodCallingConvention.Generic,
};
foreach (var parameter in self.Parameters)
reference.Parameters.Add (new ParameterDefinition
(parameter.ParameterType));
foreach (var generic_parameter in self.GenericParameters)
reference.GenericParameters.Add(new
GenericParameter(generic_parameter));
return reference;
}
Jan
--
--
mono-cecil
Subscription settings: http://groups.google.com/group/mono-cecil/subscribe?hl=en