MethodGenerifier.MakeGeneric C# (CSharp) Method

MakeGeneric() public static method

public static MakeGeneric ( TypeReference declaringType, MethodReference self ) : MethodReference
declaringType TypeReference
self Mono.Cecil.MethodReference
return Mono.Cecil.MethodReference
    public static MethodReference MakeGeneric(TypeReference declaringType, MethodReference self)
    {
        var reference = new MethodReference(self.Name, self.ReturnType)
                            {
                                DeclaringType = declaringType,
                                HasThis = self.HasThis,
                                ExplicitThis = self.ExplicitThis,
                                CallingConvention = self.CallingConvention,
                            };

        foreach (var parameter in self.Parameters)
        {
            reference.Parameters.Add(new ParameterDefinition(parameter.ParameterType));
        }

        return reference;
    }

Usage Example

コード例 #1
0
    void ProcessChildNode(TypeNode node, MethodReference changedInvokerMethod)
    {
        var childEventInvoker = FindEventInvokerMethod(node.TypeDefinition);

        if (childEventInvoker == null)
        {
            if (changedInvokerMethod != null)
            {
                if (node.TypeDefinition.BaseType.IsGenericInstance)
                {
                    var methodReference = MethodGenerifier.MakeGeneric(node.TypeDefinition.BaseType, changedInvokerMethod);
                    changedInvokerMethod = methodReference;
                }
            }
        }
        else
        {
            changedInvokerMethod = childEventInvoker;
        }

        node.IsChangedInvoker = changedInvokerMethod;

        foreach (var childNode in node.Nodes)
        {
            ProcessChildNode(childNode, changedInvokerMethod);
        }
    }
All Usage Examples Of MethodGenerifier::MakeGeneric