/// <summary>
        /// Get the specified parameters as a descriptive string.
        /// </summary>
        internal static string GetParametersAsString(string tokenStart, string tokenend, ChildList <ParameterDecl> parameterDecls)
        {
            string result = tokenStart;

            if (parameterDecls != null && parameterDecls.Count > 0)
            {
                bool isFirst = true;
                foreach (ParameterDecl parameter in parameterDecls)
                {
                    if (!isFirst)
                    {
                        result += ", ";
                    }
                    if (parameter.Modifier != ParameterModifier.None)
                    {
                        result += ParameterDecl.ParameterModifierToString(parameter.Modifier) + " ";
                    }
                    // Don't use GetDescription() on the Type, because we don't want any ShowParentTypes here
                    result += parameter.Type.AsText(RenderFlags.Description) + " " + parameter.Name;
                    isFirst = false;
                }
            }
            result += tokenend;
            return(result);
        }
Exemplo n.º 2
0
        public static void AsTextParameterInfo(CodeWriter writer, ParameterInfo parameterInfo, RenderFlags flags)
        {
            RenderFlags passFlags = flags & ~RenderFlags.Description;

            Attribute.AsTextAttributes(writer, parameterInfo);

            ParameterModifier modifier = GetParameterModifier(parameterInfo);

            if (modifier != ParameterModifier.None)
            {
                writer.Write(ParameterDecl.ParameterModifierToString(modifier) + " ");
            }

            Type parameterType = parameterInfo.ParameterType;

            if (parameterType.IsByRef)
            {
                // Dereference (remove the trailing '&') if it's a reference type
                parameterType = parameterType.GetElementType();
            }
            TypeRefBase.AsTextType(writer, parameterType, passFlags);
            writer.Write(" " + parameterInfo.Name);
        }