internal static MethodDescriptor Create(MethodBase method, Assembly containingAssembly, bool isDeclaration)
        {
            MethodDescriptor descriptor = null;

            if (method is MethodBuilder)
            {
                if (method.IsGenericMethod)
                {
                    descriptor = new MethodGenericDeclarationDescriptor(method, containingAssembly);
                }
                else
                {
                    descriptor = new MethodDescriptor(method, containingAssembly, isDeclaration);
                }
            }
            else if (method.IsGenericMethodDefinition)
            {
                descriptor = new MethodGenericDeclarationDescriptor(method, containingAssembly);
            }
            else if (method.IsGenericMethod)
            {
                descriptor = new MethodGenericInvocationDescriptor(method, containingAssembly);
            }
            else
            {
                descriptor = new MethodDescriptor(method, containingAssembly, isDeclaration);
            }

            return(descriptor);
        }
        internal static MethodDescriptor Create(MethodBase method, Assembly containingAssembly, bool isDeclaration)
        {
            MethodDescriptor descriptor = null;

            if(method is MethodBuilder)
            {
                if(method.IsGenericMethod)
                {
                    descriptor = new MethodGenericDeclarationDescriptor(method, containingAssembly);
                }
                else
                {
                    descriptor = new MethodDescriptor(method, containingAssembly, isDeclaration);
                }
            }
            else if(method.IsGenericMethodDefinition)
            {
                descriptor = new MethodGenericDeclarationDescriptor(method, containingAssembly);
            }
            else if(method.IsGenericMethod)
            {
                descriptor = new MethodGenericInvocationDescriptor(method, containingAssembly);
            }
            else
            {
                descriptor = new MethodDescriptor(method, containingAssembly, isDeclaration);
            }

            return descriptor;
        }
        internal MethodGenericInvocationDescriptor(MethodBase method, Assembly containingAssembly)
            : this()
        {
            var parts = new List <string>();

            MethodGenericInvocationDescriptor.AddLocation(method, parts);
            MethodGenericInvocationDescriptor.AddCallingConventions(method, parts);
            MethodGenericInvocationDescriptor.AddReturnValue(method, containingAssembly, parts);

            parts.Add(method.GetName(containingAssembly, false) +
                      MethodGenericDescriptor.GetGenericDeclarationInformation(
                          method as MethodInfo, containingAssembly, false) +
                      MethodGenericInvocationDescriptor.GetMethodArgumentInformation(method, containingAssembly));

            this.Value = string.Join(" ", parts.ToArray());
        }