Exemplo n.º 1
0
        /// <summary>
        /// Creates a new closed generic method representation object.
        /// </summary>
        /// <param name="declaringType">The declaring type of the generic method.</param>
        /// <param name="methodDefinition">Generic method definition.</param>
        /// <param name="arguments">Generic type arguments.</param>
        internal GenericMethodInfoSlim(TypeSlim declaringType, GenericDefinitionMethodInfoSlim methodDefinition, ReadOnlyCollection <TypeSlim> arguments)
            : base(declaringType)
        {
            Debug.Assert(methodDefinition != null);
            Debug.Assert(arguments != null);

            GenericMethodDefinition = methodDefinition;
            GenericArguments        = arguments;
        }
        protected override string VisitGenericDefinitionMethod(GenericDefinitionMethodInfoSlim method)
        {
            var declaringType         = _typePrinter.Visit(method.DeclaringType);
            var parameterTypes        = string.Join(", ", _typePrinter.Visit(method.ParameterTypes));
            var returnType            = _typePrinter.Visit(method.ReturnType);
            var genericParameterTypes = string.Join(", ", _typePrinter.Visit(method.GenericParameterTypes));

            return(string.Format(CultureInfo.InvariantCulture, "{3} {0}.{1}<{4}>({2})", declaringType, method.Name, parameterTypes, returnType, genericParameterTypes));
        }