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 MethodGenericDeclarationDescriptor(MethodBase method, Assembly containingAssembly)
            : base()
        {
            var descriptors = new List <string>();

            MethodGenericDeclarationDescriptor.AddAttributes(method, descriptors);
            MethodGenericDeclarationDescriptor.AddLocation(method, descriptors);
            MethodGenericDeclarationDescriptor.AddCallingConventions(method, descriptors);
            MethodGenericDeclarationDescriptor.AddReturnType(method, containingAssembly, descriptors);

            descriptors.Add(method.GetName(containingAssembly, true) +
                            MethodGenericDescriptor.GetGenericDeclarationInformation(
                                (method as MethodInfo), containingAssembly, true) +
                            MethodGenericDeclarationDescriptor.GetMethodArgumentInformation(method, containingAssembly));
            descriptors.Add("cil managed");

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