internal static void AppendMethod(Method method, StringBuilder sb, bool includeParameters = true)
        {
            if (String.IsNullOrEmpty(method.Name)) {
                sb.Append("<null>");
                return;
            }

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

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

            sb.Append(method.Name);

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

                    sb.Append(arg);
                }

                sb.Append("]");
            }

            if (includeParameters) {
                sb.Append("(");
                bool first = true;
                foreach (Parameter p in method.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(")");
            }
        }
Example #2
0
 protected bool Equals(Method other) {
     return IsSignatureTarget == other.IsSignatureTarget && string.Equals(DeclaringNamespace, other.DeclaringNamespace) && string.Equals(DeclaringType, other.DeclaringType) && string.Equals(Name, other.Name) && Equals(Data, other.Data) && GenericArguments.CollectionEquals(other.GenericArguments) && Parameters.CollectionEquals(other.Parameters);
 }