private static MethodReference ResolveGenericMethod(TypeReference typeReference, MethodReference method) { var genericInstanceType = typeReference as GenericInstanceType; if (genericInstanceType != null) return method.MakeGeneric(genericInstanceType.GenericArguments.ToArray()); return method; }