Exemple #1
0
        internal void AppendMethod(StringBuilder sb, bool includeParameters = true)
        {
            if (String.IsNullOrEmpty(Name))
            {
                sb.Append("<null>");
                return;
            }

            if (!String.IsNullOrEmpty(DeclaringNamespace))
            {
                sb.Append(DeclaringNamespace).Append(".");
            }

            if (!String.IsNullOrEmpty(DeclaringType))
            {
                sb.Append(DeclaringType.Replace('+', '.')).Append(".");
            }

            sb.Append(Name);

            if (GenericArguments.Count > 0)
            {
                sb.Append("[");
                bool first = true;
                foreach (string arg in GenericArguments)
                {
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        sb.Append(",");
                    }

                    sb.Append(arg);
                }

                sb.Append("]");
            }

            if (includeParameters)
            {
                sb.Append("(");
                bool first = true;
                foreach (Parameter p in Parameters)
                {
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        sb.Append(", ");
                    }

                    if (String.IsNullOrEmpty(p.Type))
                    {
                        sb.Append("<UnknownType>");
                    }
                    else
                    {
                        sb.Append(p.Type.Replace('+', '.'));
                    }

                    sb.Append(" ");
                    sb.Append(p.Name);
                }
                sb.Append(")");
            }
        }